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