示例#1
0
  public void testEqualsSymmetry() throws Exception {
    assertTrue("equals", fType0.equals(fType1));
    assertTrue("equals", fType1.equals(fType0));

    assertTrue("equals", !fType0.equals(fType3));
    assertTrue("equals", !fType3.equals(fType0));
  }
示例#2
0
  public void testEqualsReflexivity() throws Exception {
    assertTrue("equals", fType0.equals(fType0));
    assertTrue("equals", fType3.equals(fType3));

    assertTrue("equals", !fType0.equals(fType3));
    assertTrue("equals", !fType3.equals(fType0));
  }
示例#3
0
 public void testTmfEventTypeCopy() {
   TmfEventType original = new TmfEventType(fTypeId, fLabels);
   TmfEventType type = new TmfEventType(original);
   assertEquals("getTypeId", fTypeId, type.getTypeId());
   assertEquals("getNbFields", fLabels.length, type.getNbFields());
   assertEquals("getLabels", fLabels, type.getLabels());
 }
示例#4
0
  public void testToString() {
    String expected1 = "[TmfEventType:" + TmfEventType.DEFAULT_TYPE_ID + "]";
    TmfEventType type1 = new TmfEventType();
    assertEquals("toString", expected1, type1.toString());

    String expected2 = "[TmfEventType:" + fTypeId + "]";
    TmfEventType type2 = new TmfEventType(fTypeId, fLabels);
    assertEquals("toString", expected2, type2.toString());
  }
示例#5
0
  public void testTmfEventType() {
    TmfEventType type = new TmfEventType(fTypeId, fLabels);
    try {
      assertEquals("getTypeId", fTypeId, type.getTypeId());
      assertEquals("getNbFields", fLabels.length, type.getNbFields());
      assertEquals("getFieldIndex", 0, type.getFieldIndex(fLabel0));
      assertEquals("getFieldIndex", 1, type.getFieldIndex(fLabel1));
      assertEquals("getLabels", fLabels, type.getLabels());
      assertEquals("getLabel", fLabel0, type.getLabel(0));
      assertEquals("getLabel", fLabel1, type.getLabel(1));
    } catch (TmfNoSuchFieldException e) {
      fail("getFieldIndex: no such field");
    }

    try {
      assertEquals("getFieldIndex", 0, type.getFieldIndex("Dummy"));
      fail("getFieldIndex: inexistant field");
    } catch (TmfNoSuchFieldException e) {
      // Success
    }

    try {
      type.getLabel(10);
      fail("getLabel: inexistant field");
    } catch (TmfNoSuchFieldException e) {
      // Success
    }
  }
示例#6
0
 public void testTmfEventTypeDefault() {
   TmfEventType type = new TmfEventType();
   try {
     assertEquals("getTypeId", TmfEventType.DEFAULT_TYPE_ID, type.getTypeId());
     assertEquals("getNbFields", 1, type.getNbFields());
     assertEquals("getFieldIndex", 0, type.getFieldIndex(TmfEventType.DEFAULT_LABELS[0]));
     assertEquals("getLabels", TmfEventType.DEFAULT_LABELS, type.getLabels());
     assertEquals("getLabel", TmfEventType.DEFAULT_LABELS[0], type.getLabel(0));
   } catch (TmfNoSuchFieldException e) {
     fail("getFieldIndex: no such field");
   }
 }
示例#7
0
 public void testHashCode() throws Exception {
   assertTrue("hashCode", fType0.hashCode() == fType1.hashCode());
   assertTrue("hashCode", fType0.hashCode() != fType3.hashCode());
 }
示例#8
0
 public void testEqualsNull() throws Exception {
   assertTrue("equals", !fType0.equals(null));
   assertTrue("equals", !fType3.equals(null));
 }
示例#9
0
 public void testEqualsTransivity() throws Exception {
   assertTrue("equals", fType0.equals(fType1));
   assertTrue("equals", fType1.equals(fType2));
   assertTrue("equals", fType0.equals(fType2));
 }