Skip to content

Commit

Permalink
Fixed a bug where annotations were ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Jul 9, 2013
1 parent 79a0040 commit c2f5ad9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions History.md
@@ -1,5 +1,6 @@
## [Git master](https://github.com/cucumber/cucumber-jvm/compare/v1.1.3...master) (not released)

* [Core] Fixed a bug where `@XStreamConverter` annotations were ignored (Aslak Hellesøy)
* [Android] New Cucumber-Android module ([#525](https://github.com/cucumber/cucumber-jvm/pull/525) Maximilian Fellner).
* [Build] Deploy maven SNAPSHOT versions from Travis ([#517](https://github.com/cucumber/cucumber-jvm/issues/517), [#528](https://github.com/cucumber/cucumber-jvm/pull/528) Tom Dunstan)
* [Core] JUnitFormatter to mark skipped tests as failures in strict mode ([#543](https://github.com/cucumber/cucumber-jvm/pull/543) brasmusson)
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/cucumber/runtime/ParameterInfo.java
Expand Up @@ -89,6 +89,7 @@ public Object convert(String value, LocalizedXStreams.LocalizedXStream xStream)
xStream.setParameterType(this);
SingleValueConverter converter;
xStream.processAnnotations(getRawType());
xStream.autodetectAnnotations(true); // Needed to unlock annotation processing

if (transformer != null) {
transformer.setParameterInfoAndLocale(this, xStream.getLocale());
Expand Down
@@ -1,8 +1,10 @@
package cucumber.examples.java.calculator;

import cucumber.api.Transformer;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import cucumber.deps.com.thoughtworks.xstream.annotations.XStreamConverter;

import java.util.List;

Expand Down Expand Up @@ -32,6 +34,26 @@ public void my_change_should_be_(int change) {

public static class Grocery {
public String name;
public int price;
public Price price;

public Grocery() {
super();
}
}

@XStreamConverter(Price.Converter.class)
public static class Price {
public int value;

public Price(int value) {
this.value = value;
}

public static class Converter extends Transformer<Price> {
@Override
public Price transform(String value) {
return new Price(Integer.parseInt(value));
}
}
}
}

0 comments on commit c2f5ad9

Please sign in to comment.