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,17 +300,18 @@ public class NexacroBeanWrapper {
} }
readMethod = descriptor.getReadMethod(); readMethod = descriptor.getReadMethod();
if(readMethod != null) { if(readMethod == null) {
return true; if(logger.isDebugEnabled()) {
logger.debug("skipped property {} of bean class[{}]:" +
" Bean Property {} is not readable or has an invalid getter or setter." +
" Does the return type of the getter match the parameter type of the setter"
, name, clazz, name);
}
return false;
} }
if(logger.isDebugEnabled()) {
logger.debug("skipped property {} of bean class[{}]:" +
" Bean Property {} is not readable or has an invalid getter or setter." +
" Does the return type of the getter match the parameter type of the setter"
, name, clazz, name);
}
} else if(readMethod == null || writeMethod == null) { } else if(readMethod == null || writeMethod == null) {
return false; 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.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import junit.framework.Assert; import junit.framework.Assert;
@@ -43,6 +44,16 @@ public class NexacroBeanWrapperTest {
assertTrue("Set name to tom", target.getFirstName().equals("tom")); 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 @Rule
public ExpectedException thrown= ExpectedException.none(); public ExpectedException thrown= ExpectedException.none();
@@ -63,4 +74,23 @@ public class NexacroBeanWrapperTest {
return beanWrapper; 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;
}
}
} }