not defined getter(static) error
This commit is contained in:
@@ -300,10 +300,7 @@ public class NexacroBeanWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
readMethod = descriptor.getReadMethod();
|
readMethod = descriptor.getReadMethod();
|
||||||
if(readMethod != null) {
|
if(readMethod == null) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(logger.isDebugEnabled()) {
|
if(logger.isDebugEnabled()) {
|
||||||
logger.debug("skipped property {} of bean class[{}]:" +
|
logger.debug("skipped property {} of bean class[{}]:" +
|
||||||
" Bean Property {} is not readable or has an invalid getter or setter." +
|
" Bean Property {} is not readable or has an invalid getter or setter." +
|
||||||
@@ -311,6 +308,10 @@ public class NexacroBeanWrapper {
|
|||||||
, name, clazz, name);
|
, name, clazz, name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else if(readMethod == null || writeMethod == null) {
|
} else if(readMethod == null || writeMethod == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user