示例#1
0
  @Test
  public void testHasTag() {
    DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
    assertFalse(di.hasTag());

    di.setTag(new Tag(1));
    assertTrue(di.hasTag());
  }
示例#2
0
  @Test
  public void testGetTag() {
    DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
    di.setTag(new Tag(1));

    Tag t = di.getTag();
    assertEquals(1L, t.getValue());
  }
示例#3
0
 @Test
 public void testEquals() {
   DataItem a = new TestDataItem();
   DataItem b = new TestDataItem();
   assertEquals(a, b);
   a.setTag(1);
   assertFalse(a.equals(b));
   assertFalse(a.equals(null));
 }
示例#4
0
  @Test
  public void testRemoveTag() {
    DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
    di.setTag(new Tag(1));
    assertNotNull(di.getTag());

    di.removeTag();
    assertNull(di.getTag());
  }
示例#5
0
 @Test(expected = NullPointerException.class)
 public void testSetTag_Tag_null() {
   DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
   di.setTag(null);
 }
示例#6
0
 @Test(expected = IllegalArgumentException.class)
 public void testSetTag_Long_negative() {
   DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
   di.setTag(-1);
 }
示例#7
0
 @Test
 public void testSetTag_Long() {
   DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
   di.setTag(1);
   assertNotNull(di.getTag());
 }