/** * Creates a new Property Value from the given object. * * If the given object type is not supported, an * {@link UnsupportedTypeException} will be thrown. * * @param value value with supported type * @return property value */ public static PropertyValue create(Object value) { return new PropertyValue(value); }
@Override public PropertyValue next() { PropertyValue nextValue = new PropertyValue(); try { DataInputView inputView = new DataInputViewStreamWrapper(inputStream); nextValue.read(inputView); } catch (IOException e) { e.printStackTrace(); } return nextValue; }
@Override public void read(DataInputView inputView) throws IOException { key = inputView.readUTF(); value = new PropertyValue(); value.read(inputView); }
@Test(expected = UnsupportedTypeException.class) public void testSetObjectWithUnsupportedType() { PropertyValue p = new PropertyValue(); p.setObject(new PriorityQueue<>()); }
@Test public void testLargeArrayValue() { PropertyValue property = new PropertyValue(); property.setBytes(new byte[PropertyValue.LARGE_PROPERTY_THRESHOLD + 1]); }
@Test public void testArrayValueMaxSize() { PropertyValue property = new PropertyValue(); property.setBytes(new byte[PropertyValue.LARGE_PROPERTY_THRESHOLD]); }
@Test public void testSetShort() throws Exception { PropertyValue p = new PropertyValue(); p.setShort(SHORT_VAL_e); assertEquals(SHORT_VAL_e, p.getShort()); }
@Test public void testSetFloat() throws Exception { PropertyValue p = new PropertyValue(); p.setFloat(FLOAT_VAL_4); assertEquals(FLOAT_VAL_4, p.getFloat(), 0); }
@Test public void testSetSet() throws Exception { PropertyValue p = new PropertyValue(); p.setSet(SET_VAL_f); assertEquals(SET_VAL_f, p.getSet()); }
@Test public void testSetLong() throws Exception { PropertyValue p = new PropertyValue(); p.setLong(LONG_VAL_3); assertEquals(LONG_VAL_3, p.getLong()); }
@Test public void testSetBoolean() throws Exception { PropertyValue p = new PropertyValue(); p.setBoolean(BOOL_VAL_1); assertEquals(BOOL_VAL_1, p.getBoolean()); }
@Test public void testSetInt() throws Exception { PropertyValue p = new PropertyValue(); p.setInt(INT_VAL_2); assertEquals(INT_VAL_2, p.getInt()); }
@Test public void testSetDouble() throws Exception { PropertyValue p = new PropertyValue(); p.setDouble(DOUBLE_VAL_5); assertEquals(DOUBLE_VAL_5, p.getDouble(), 0); }
@Test public void testSetList() throws Exception { PropertyValue p = new PropertyValue(); p.setList(LIST_VAL_a); assertEquals(LIST_VAL_a, p.getList()); }
@Test public void testSetTime() throws Exception { PropertyValue p = new PropertyValue(); p.setTime(TIME_VAL_c); assertEquals(TIME_VAL_c, p.getTime()); }
@Test public void testSetDateTime() throws Exception { PropertyValue p = new PropertyValue(); p.setDateTime(DATETIME_VAL_d); assertEquals(DATETIME_VAL_d, p.getDateTime()); }
@Test public void testSetString() throws Exception { PropertyValue p = new PropertyValue(); p.setString(STRING_VAL_6); assertEquals(STRING_VAL_6, p.getString()); }
@Test public void testSetGradoopId() throws Exception { PropertyValue p = new PropertyValue(); p.setGradoopId(GRADOOP_ID_VAL_8); assertEquals(GRADOOP_ID_VAL_8, p.getGradoopId()); }
@Test public void testSetMap() throws Exception { PropertyValue p = new PropertyValue(); p.setMap(MAP_VAL_9); assertEquals(MAP_VAL_9, p.getMap()); }
@Test public void testSetDate() throws Exception { PropertyValue p = new PropertyValue(); p.setDate(DATE_VAL_b); assertEquals(DATE_VAL_b, p.getDate()); }