Skip to content

Commit

Permalink
change tests to cover more
Browse files Browse the repository at this point in the history
Note: Also will delete CLASS from annotation type because it is already the default value
  • Loading branch information
yasserzamani committed Jan 7, 2018
1 parent 4394238 commit 9739291
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Bar getSupperBarObj() {
return bar;
}

@TypeConversion(converterClass = FooBarConverter.class)
@TypeConversion(converter = "com.opensymphony.xwork2.conversion.impl.FooBarConverter")
public void setSupperBarObj(Bar b) {
bar = b;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
converterClass=AddressTypeConverter.class),
@TypeConversion(type=ConversionType.APPLICATION,
key="com.opensymphony.xwork2.test.annotations.Person",
converterClass=PersonTypeConverter.class)})
converter="com.opensymphony.xwork2.test.annotations.PersonTypeConverter")})
public class PersonAction {
List<Person> users;
private List<Address> address;
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/com/opensymphony/xwork2/util/Foo.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void setAnnotatedCats(List annotatedCats) {
this.annotatedCats = annotatedCats;
}

@TypeConversion(type = ConversionType.CLASS, rule = ConversionRule.ELEMENT, converterClass = Cat.class)
@TypeConversion(rule = ConversionRule.ELEMENT, converterClass = Cat.class)
public List getAnnotatedCats() {
return annotatedCats;
}
Expand Down Expand Up @@ -169,12 +169,12 @@ public void setBarCollection(Collection barCollection) {
this.barCollection = barCollection;
}

@TypeConversion(type = ConversionType.CLASS, rule = ConversionRule.KEY_PROPERTY, value = "id")
@TypeConversion(rule = ConversionRule.KEY_PROPERTY, value = "id")
public void setAnnotatedBarCollection(Collection annotatedBarCollection) {
this.annotatedBarCollection = annotatedBarCollection;
}

@TypeConversion(type = ConversionType.CLASS, rule = ConversionRule.ELEMENT, converterClass = Bar.class)
@TypeConversion(rule = ConversionRule.ELEMENT, converter = "com.opensymphony.xwork2.util.Bar")
public Collection getAnnotatedBarCollection() {
return annotatedBarCollection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@
*/
@Conversion(
conversions= {
@TypeConversion(key = "Key_annotatedBeanMap", type = ConversionType.CLASS, rule = ConversionRule.KEY, converterClass = Long.class),
@TypeConversion(key = "KeyProperty_annotatedBeanMap", type = ConversionType.CLASS, rule = ConversionRule.KEY_PROPERTY, value = "id"),
@TypeConversion(key = "Element_annotatedBeanMap", type = ConversionType.CLASS, rule = ConversionRule.ELEMENT, converterClass = MyBean.class),
@TypeConversion(key = "CreateIfNull_annotatedBeanList", type = ConversionType.CLASS, rule = ConversionRule.CREATE_IF_NULL, value = "true"),
@TypeConversion(key = "KeyProperty_annotatedBeanList", type = ConversionType.CLASS, rule = ConversionRule.KEY_PROPERTY, value = "id"),
@TypeConversion(key = "Element_annotatedBeanList", type = ConversionType.CLASS, rule = ConversionRule.ELEMENT, converterClass = MyBean.class)
@TypeConversion(key = "KeyProperty_annotatedBeanMap", rule = ConversionRule.KEY_PROPERTY, value = "id"),
@TypeConversion(key = "Element_annotatedBeanMap", rule = ConversionRule.ELEMENT, converterClass = MyBean.class),
@TypeConversion(key = "KeyProperty_annotatedBeanList", rule = ConversionRule.KEY_PROPERTY, value = "id"),
@TypeConversion(key = "Element_annotatedBeanList", rule = ConversionRule.ELEMENT, converterClass = MyBean.class)
})
public class MyBeanAction implements Action {

Expand Down Expand Up @@ -70,6 +68,7 @@ public Map getAnnotatedBeanMap() {
return annotatedBeanMap;
}

@TypeConversion(rule = ConversionRule.KEY, converterClass = Long.class)
public void setAnnotatedBeanMap(Map annotatedBeanMap) {
this.annotatedBeanMap = annotatedBeanMap;
}
Expand All @@ -78,6 +77,7 @@ public List getAnnotatedBeanList() {
return annotatedBeanList;
}

@TypeConversion(rule = ConversionRule.CREATE_IF_NULL, value = "true")
public void setAnnotatedBeanList(List annotatedBeanList) {
this.annotatedBeanList = annotatedBeanList;
}
Expand Down

0 comments on commit 9739291

Please sign in to comment.