Ejemplo n.º 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));
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 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());
 }
Ejemplo n.º 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());
  }
Ejemplo n.º 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
    }
  }
Ejemplo n.º 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");
   }
 }
Ejemplo n.º 7
0
 public void testHashCode() throws Exception {
   assertTrue("hashCode", fType0.hashCode() == fType1.hashCode());
   assertTrue("hashCode", fType0.hashCode() != fType3.hashCode());
 }
Ejemplo n.º 8
0
 public void testEqualsNull() throws Exception {
   assertTrue("equals", !fType0.equals(null));
   assertTrue("equals", !fType3.equals(null));
 }
Ejemplo n.º 9
0
 public void testEqualsTransivity() throws Exception {
   assertTrue("equals", fType0.equals(fType1));
   assertTrue("equals", fType1.equals(fType2));
   assertTrue("equals", fType0.equals(fType2));
 }