Skip to content

Commit

Permalink
Optimize imports, format code
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Feb 29, 2012
1 parent 5df9613 commit aecd8b8
Show file tree
Hide file tree
Showing 47 changed files with 355 additions and 322 deletions.
3 changes: 2 additions & 1 deletion clojure/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
3 changes: 2 additions & 1 deletion core/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/cucumber/runtime/RuntimeGlue.java
Expand Up @@ -16,10 +16,8 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

import static cucumber.runtime.model.CucumberFeature.load;
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/cucumber/runtime/ScenarioResult.java
Expand Up @@ -19,18 +19,18 @@ public interface ScenarioResult {

/**
* Embeds data into the report(s). Some reporters (such as the progress one) don't embed data, but others do (html and json).
*
*
* @param data what to embed, for example an image.
* @param mimeType what is the data?
* @see cucumber.formatter.ProgressFormatter
* @see cucumber.formatter.HTMLFormatter
* @see gherkin.formatter.JSONFormatter
* @param data what to embed, for example an image.
* @param mimeType what is the data?
*/
void embed(InputStream data, String mimeType);

/**
* Outputs some text into the report.
*
*
* @param text what to put in the report.
*/
void write(String text);
Expand Down
3 changes: 0 additions & 3 deletions core/src/main/java/cucumber/runtime/Utils.java
@@ -1,8 +1,5 @@
package cucumber.runtime;

import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Iterator;
Expand Down
3 changes: 2 additions & 1 deletion examples/groovy-calculator/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
3 changes: 2 additions & 1 deletion examples/java-calculator/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
26 changes: 14 additions & 12 deletions examples/java-webbit-websockets-selenium/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -65,17 +66,18 @@
<configuration>
<target>
<echo>Running cucumber from the command line</echo>
<mkdir dir="target/cukes" />
<java classname="cucumber.cli.Main" fork="true" failonerror="true" newenvironment="true" maxmemory="512m" classpathref="maven.test.classpath">
<arg value="--dotcucumber" />
<arg value="${basedir}/src/test/resources/.cucumber" />
<arg value="--format" />
<arg value="html" />
<arg value="--out" />
<arg value="target/cukes" />
<arg value="--glue" />
<arg value="cucumber.examples.java.websockets" />
<arg value="${basedir}/src/test/resources" />
<mkdir dir="target/cukes"/>
<java classname="cucumber.cli.Main" fork="true" failonerror="true" newenvironment="true"
maxmemory="512m" classpathref="maven.test.classpath">
<arg value="--dotcucumber"/>
<arg value="${basedir}/src/test/resources/.cucumber"/>
<arg value="--format"/>
<arg value="html"/>
<arg value="--out"/>
<arg value="target/cukes"/>
<arg value="--glue"/>
<arg value="cucumber.examples.java.websockets"/>
<arg value="${basedir}/src/test/resources"/>
</java>
</target>
</configuration>
Expand Down
@@ -1,42 +1,42 @@
[
{
"source": "^I am on the front page$",
"flags": "",
"steps": [
{
"name": "I am on the front page",
"args": []
}
]
},
{
"source": "^I enter (.+) Celcius$",
"flags": "",
"steps": [
{
"name": "I enter 0 Celcius",
"args": [
{
"offset": 8,
"val": "0"
}
{
"source": "^I am on the front page$",
"flags": "",
"steps": [
{
"name": "I am on the front page",
"args": []
}
]
}
]
},
{
"source": "^I should see (.+) Fahrenheit$",
"flags": "",
"steps": [
{
"name": "I should see 32.0 Fahrenheit",
"args": [
{
"offset": 13,
"val": "32.0"
}
},
{
"source": "^I enter (.+) Celcius$",
"flags": "",
"steps": [
{
"name": "I enter 0 Celcius",
"args": [
{
"offset": 8,
"val": "0"
}
]
}
]
}
]
}
},
{
"source": "^I should see (.+) Fahrenheit$",
"flags": "",
"steps": [
{
"name": "I should see 32.0 Fahrenheit",
"args": [
{
"offset": 13,
"val": "32.0"
}
]
}
]
}
]
3 changes: 2 additions & 1 deletion examples/scala-calculator/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
2 changes: 1 addition & 1 deletion groovy/bin/cucumber-jvm.groovy
@@ -1,3 +1,3 @@
scriptDir = new File(getClass().protectionDomain.codeSource.location.path).getParent();
if(this.class.classLoader.rootLoader) this.class.classLoader.rootLoader.addURL(new File(scriptDir, "cucumber-groovy-full.jar").toURL())
if (this.class.classLoader.rootLoader) this.class.classLoader.rootLoader.addURL(new File(scriptDir, "cucumber-groovy-full.jar").toURL())
this.class.classLoader.loadClass("cucumber.cli.Main").main(args)
9 changes: 6 additions & 3 deletions groovy/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -105,7 +106,8 @@
<phase>generate-sources</phase>
<configuration>
<target>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="maven.plugin.classpath" />
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"
classpathref="maven.plugin.classpath"/>

<groovy><![CDATA[
import groovy.text.SimpleTemplateEngine
Expand All @@ -131,7 +133,8 @@ I18n.all.each { i18n ->
<phase>package</phase>
<configuration>
<target>
<copy file="${project.build.directory}/${project.build.finalName}-full.jar" tofile="${basedir}/bin/cucumber-groovy-full.jar" />
<copy file="${project.build.directory}/${project.build.finalName}-full.jar"
tofile="${basedir}/bin/cucumber-groovy-full.jar"/>
</target>
</configuration>
<goals>
Expand Down
Expand Up @@ -13,7 +13,7 @@ Given(~'^I have (\\d+) apples in my belly') { int apples ->
lastAte('apples')
}

Given(~'^a big basket with cukes') { ->
Given(~'^a big basket with cukes') {->
}

Then(~'^there are (\\d+) cukes in my belly') { int cukes ->
Expand Down
3 changes: 2 additions & 1 deletion guice/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
@@ -1,7 +1,7 @@
package cucumber.runtime.java.guice;

public class GuiceModuleInstantiationFailed extends RuntimeException{
public class GuiceModuleInstantiationFailed extends RuntimeException {

public GuiceModuleInstantiationFailed(String message, Throwable cause) {
super(message, cause);
}
Expand Down
@@ -1,11 +1,11 @@
package cucumber.runtime.java.guice;

import static java.text.MessageFormat.format;
import com.google.inject.Module;

import java.util.Collections;
import java.util.List;

import com.google.inject.Module;
import static java.text.MessageFormat.format;

public class ModuleInstantiator {
public List<Module> instantiate(String moduleClassName) {
Expand Down
Expand Up @@ -5,7 +5,9 @@

import java.io.IOException;

import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;

public class GuiceFactoryTest {
@Test
Expand Down
@@ -1,40 +1,38 @@
package cucumber.runtime.java.guice;

import com.google.inject.Module;
import cucumber.runtime.java.guice.loadguicemodule.YourModuleClass;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import org.junit.Test;

import com.google.inject.Module;

import cucumber.runtime.java.guice.loadguicemodule.YourModuleClass;

public class ModuleInstantiatorTest {
private final ModuleInstantiator instantiator = new ModuleInstantiator();

@Test
public void instantiatesModuleByFullyQualifiedName() throws Exception {
assertThat(instantiate(YourModuleClass.class), is(instanceOf(YourModuleClass.class)));
}

@Test(expected=GuiceModuleInstantiationFailed.class)
@Test(expected = GuiceModuleInstantiationFailed.class)
public void fails_to_instantiate_non_existant_class() throws Exception {
instantiator.instantiate("some.bogus.Class");
}
@Test(expected=GuiceModuleInstantiationFailed.class)

@Test(expected = GuiceModuleInstantiationFailed.class)
public void fails_to_instantiate_class_not_implementing_module() throws Exception {
instantiate(String.class);
}
@Test(expected=GuiceModuleInstantiationFailed.class)

@Test(expected = GuiceModuleInstantiationFailed.class)
public void fails_to_instantiate_class_with_private_constructor() throws Exception {
instantiate(PrivateConstructor.class);
}

private Module instantiate(Class<?> moduleClass) {
String moduleClassName = moduleClass.getCanonicalName();
return instantiator.instantiate(moduleClassName).get(0);
}
}
}
@@ -1,15 +1,14 @@
package cucumber.runtime.java.guice.loadguicemodule;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import cucumber.annotation.en.Then;

import javax.inject.Inject;


import cucumber.annotation.en.Then;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class SecondSteps {

private final SharedBetweenSteps shared;

@Inject
Expand Down
Expand Up @@ -2,7 +2,7 @@

import com.google.inject.AbstractModule;

public class YourModuleClass extends AbstractModule{
public class YourModuleClass extends AbstractModule {

@Override
protected void configure() {
Expand Down
@@ -1,9 +1,8 @@
package cucumber.runtime.java.guice.loadguicemodule;

import org.junit.runner.RunWith;

import cucumber.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class )
@RunWith(Cucumber.class)
public class loadguicemodule {
}
3 changes: 2 additions & 1 deletion ioke/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
6 changes: 4 additions & 2 deletions java/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -54,7 +55,8 @@
<phase>generate-sources</phase>
<configuration>
<target>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="maven.plugin.classpath" />
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"
classpathref="maven.plugin.classpath"/>

<groovy><![CDATA[
import groovy.text.SimpleTemplateEngine
Expand Down

0 comments on commit aecd8b8

Please sign in to comment.