use of org.apache.geode.pdx.WritablePdxInstance in project geode by apache.
the class CopyJUnitTest method testIsWellKnownImmutableInstance.
@Test
public void testIsWellKnownImmutableInstance() {
assertEquals(true, CopyHelper.isWellKnownImmutableInstance("abc"));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(Integer.valueOf(0)));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(Long.valueOf(0)));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(Byte.valueOf((byte) 0)));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(Short.valueOf((short) 0)));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(Float.valueOf((float) 1.2)));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(Double.valueOf(1.2)));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(Character.valueOf((char) 0)));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(new BigInteger("1234")));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(new BigDecimal("123.4556")));
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(new UUID(1L, 2L)));
PdxInstance pi = new PdxInstance() {
public Object getObject() {
return null;
}
public Object getObject(Object pdxObject) {
return null;
}
public boolean hasField(String fieldName) {
return false;
}
public List<String> getFieldNames() {
return null;
}
public boolean isIdentityField(String fieldName) {
return false;
}
public Object getField(String fieldName) {
return null;
}
public WritablePdxInstance createWriter() {
return null;
}
public String getClassName() {
return null;
}
public boolean isEnum() {
return false;
}
};
WritablePdxInstance wpi = new WritablePdxInstance() {
public Object getObject() {
return null;
}
public Object getObject(Object pdxObject) {
return null;
}
public boolean hasField(String fieldName) {
return false;
}
public List<String> getFieldNames() {
return null;
}
public boolean isIdentityField(String fieldName) {
return false;
}
public Object getField(String fieldName) {
return null;
}
public WritablePdxInstance createWriter() {
return null;
}
public void setField(String fieldName, Object value) {
}
public String getClassName() {
return null;
}
public boolean isEnum() {
return false;
}
};
assertEquals(true, CopyHelper.isWellKnownImmutableInstance(pi));
assertEquals(false, CopyHelper.isWellKnownImmutableInstance(wpi));
assertEquals(false, CopyHelper.isWellKnownImmutableInstance(new Object()));
}
Aggregations