예제 #1
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
    }
  }
예제 #2
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());
 }
예제 #3
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");
   }
 }