|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -61,6 +61,14 @@ public class BeanWrapperTests extends AbstractPropertyAccessorTests { |
|
|
|
assertTrue("Set name to tom", target.getName().equals("tom")); |
|
|
|
assertTrue("Set name to tom", target.getName().equals("tom")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void aliasedSetterThroughDefaultMethod() { |
|
|
|
|
|
|
|
GetterBean target = new GetterBean(); |
|
|
|
|
|
|
|
BeanWrapper accessor = createAccessor(target); |
|
|
|
|
|
|
|
accessor.setPropertyValue("aliasedName", "tom"); |
|
|
|
|
|
|
|
assertTrue("Set name to tom", target.getAliasedName().equals("tom")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void setValidAndInvalidPropertyValuesShouldContainExceptionDetails() { |
|
|
|
public void setValidAndInvalidPropertyValuesShouldContainExceptionDetails() { |
|
|
|
TestBean target = new TestBean(); |
|
|
|
TestBean target = new TestBean(); |
|
|
|
@ -196,7 +204,24 @@ public class BeanWrapperTests extends AbstractPropertyAccessorTests { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
@SuppressWarnings("unused") |
|
|
|
private static class GetterBean { |
|
|
|
private interface AliasedProperty { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default void setAliasedName(String name) { |
|
|
|
|
|
|
|
setName(name); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default String getAliasedName() { |
|
|
|
|
|
|
|
return getName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setName(String name); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String getName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
|
|
|
|
private static class GetterBean implements AliasedProperty { |
|
|
|
|
|
|
|
|
|
|
|
private String name; |
|
|
|
private String name; |
|
|
|
|
|
|
|
|
|
|
|
@ -212,6 +237,7 @@ public class BeanWrapperTests extends AbstractPropertyAccessorTests { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
@SuppressWarnings("unused") |
|
|
|
private static class IntelliBean { |
|
|
|
private static class IntelliBean { |
|
|
|
|
|
|
|
|
|
|
|
|