not defined getter(static) error

This commit is contained in:
ParkSeongMin
2016-02-11 10:05:36 +09:00
parent 70b1bfa85e
commit 1f52245242
2 changed files with 481 additions and 450 deletions

View File

@@ -300,10 +300,7 @@ public class NexacroBeanWrapper {
}
readMethod = descriptor.getReadMethod();
if(readMethod != null) {
return true;
}
if(readMethod == null) {
if(logger.isDebugEnabled()) {
logger.debug("skipped property {} of bean class[{}]:" +
" Bean Property {} is not readable or has an invalid getter or setter." +
@@ -311,6 +308,10 @@ public class NexacroBeanWrapper {
, name, clazz, name);
}
return false;
}
} else if(readMethod == null || writeMethod == null) {
return false;

View File

@@ -2,6 +2,7 @@ package com.nexacro.spring.data.support;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import junit.framework.Assert;
@@ -43,6 +44,16 @@ public class NexacroBeanWrapperTest {
assertTrue("Set name to tom", target.getFirstName().equals("tom"));
}
@Test
public void testNotDefiendReadableProperty() {
NexacroBeanWrapper accessor = createAccessor(NotDefinedStaticGetter.class);
NexacroBeanProperty property = accessor.getProperty("staticProp");
assertNull("not defined static getter must be null.", property);
}
@Rule
public ExpectedException thrown= ExpectedException.none();
@@ -63,4 +74,23 @@ public class NexacroBeanWrapperTest {
return beanWrapper;
}
private static class NotDefinedStaticGetter {
private static String staticProp;
private String dummy;
public static void setStaticProp(String staticProp) {
NotDefinedStaticGetter.staticProp = staticProp;
}
public String getDummy() {
return dummy;
}
public void setDummy(String dummy) {
this.dummy = dummy;
}
}
}