Field implements Serializable { public int getTag() { return tag; } Field(int field, T object); int getTag(); int getField(); T getObject(); @Override String toString(); boolean equals(Object object); int hashCode(); void setTag(int tag);  }
@Test public void testDateField() { DateField field = new DateField(11); Date date = new Date(); field.setValue(date); assertEquals(11, field.getTag()); assertEquals(date, field.getValue()); field = new DateField(11, date); assertEquals(11, field.getTag()); assertEquals(date, field.getValue()); }
@Test public void testUtcDateOnlyField() { UtcDateOnlyField field = new UtcDateOnlyField(11); LocalDate date = LocalDate.now(); field.setValue(date); assertEquals(11, field.getTag()); assertEquals(date, field.getValue()); field = new UtcDateOnlyField(11, date); assertEquals(11, field.getTag()); assertEquals(date, field.getValue()); }
@Test public void testUtcTimeOnlyField() { UtcTimeOnlyField field = new UtcTimeOnlyField(11); LocalTime date = LocalTime.now(); field.setValue(date); assertEquals(11, field.getTag()); assertEquals(date, field.getValue()); field = new UtcTimeOnlyField(11, date); assertEquals(11, field.getTag()); assertEquals(date, field.getValue()); }
@Test public void testUtcTimeStampField() { UtcTimeStampField field = new UtcTimeStampField(11); LocalDateTime date = LocalDateTime.now(); field.setValue(date); assertEquals(11, field.getTag()); assertEquals(date, field.getValue()); field = new UtcTimeStampField(11, date); assertEquals(11, field.getTag()); assertEquals(date, field.getValue()); }
@Test public void testBooleanField() { BooleanField field = new BooleanField(11); field.setValue(true); assertEquals(11, field.getTag()); assertTrue(field.getValue()); field.setValue(Boolean.FALSE); assertEquals(11, field.getTag()); assertFalse(field.getValue()); field = new BooleanField(22, true); assertEquals(22, field.getTag()); assertTrue(field.getValue()); field = new BooleanField(33, Boolean.TRUE); assertEquals(33, field.getTag()); assertTrue(field.getValue()); }
@Test public void testDoubleField() { DoubleField field = new DoubleField(11); field.setValue(12.3); assertEquals(11, field.getTag()); assertEquals(12.3, field.getValue(), 0); field.setValue(new Double(23.4)); assertEquals(11, field.getTag()); assertEquals(23.4, field.getValue(), 0); field = new DoubleField(22, 34.5); assertEquals(22, field.getTag()); assertEquals(34.5, field.getValue(), 0); field = new DoubleField(33, new Double(45.6)); assertEquals(33, field.getTag()); assertEquals(45.6, field.getValue(), 0); }
@Test public void testDecimalField() { DecimalField field = new DecimalField(11); field.setValue(12.3); assertEquals(11, field.getTag()); assertEquals(BigDecimal.valueOf(12.3), field.getValue()); field.setValue(23.4); assertEquals(11, field.getTag()); assertEquals(BigDecimal.valueOf(23.4), field.getValue()); field = new DecimalField(22, 34.5); assertEquals(22, field.getTag()); assertEquals(BigDecimal.valueOf(34.5), field.getValue()); field = new DecimalField(33, 45.6); assertEquals(33, field.getTag()); assertEquals(BigDecimal.valueOf(45.6), field.getValue()); }
@Test public void testCharField() { CharField field = new CharField(11); field.setValue('x'); assertEquals(11, field.getTag()); assertEquals('x', field.getValue()); field.setValue(Character.valueOf('X')); assertEquals(11, field.getTag()); assertEquals('X', field.getValue()); field = new CharField(22, 'a'); assertEquals(22, field.getTag()); assertEquals('a', field.getValue()); field = new CharField(33, Character.valueOf('A')); assertEquals(33, field.getTag()); assertEquals('A', field.getValue()); }
@Test public void testIntField() { IntField field = new IntField(11); field.setValue(12); assertEquals(11, field.getTag()); assertEquals(12, field.getValue()); field.setValue(Integer.valueOf(23)); assertEquals(11, field.getTag()); assertEquals(23, field.getValue()); field = new IntField(22, 23); assertEquals(22, field.getTag()); assertEquals(23, field.getValue()); field = new IntField(33, Integer.valueOf(44)); assertEquals(33, field.getTag()); assertEquals(44, field.getValue()); }