OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
itemNames, itemDescriptions, itemTypes);
String[] indexNames = new String[] { "name1", "name2" };
TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
assertTrue("null is not equal to tabular type", tabularType.equals(null) == false);
assertTrue("object is not a equal to tabular type", tabularType.equals(new Object()) == false);
TabularType tabularType2 = new TabularType("typeName", "description", rowType, indexNames);
assertTrue("Should be equal, even though the tabular type is a different instance",
tabularType.equals(tabularType2));
assertTrue("Should be equal, even though the tabular type is a different instance",
tabularType2.equals(tabularType));
tabularType2 = new TabularType("typeName2", "description", rowType, indexNames);
assertTrue("should not be equal, they have different type names",
tabularType.equals(tabularType2) == false);
assertTrue("should not be equal, they have different type names",
tabularType2.equals(tabularType) == false);
CompositeType rowType2 = new CompositeType("rowTypeName2", "rowDescription",
itemNames, itemDescriptions, itemTypes);
tabularType2 = new TabularType("typeName", "description", rowType2, indexNames);
assertTrue("should not be a equal, they have different row types",
tabularType.equals(tabularType2) == false);
assertTrue("should not be a equal, they have different row types",
tabularType2.equals(tabularType) == false);
String[] indexNames2 = new String[] { "name2", "name1" };
tabularType2 = new TabularType("typeName", "description", rowType, indexNames2);
assertTrue("should not be equal, they have different index names",
tabularType.equals(tabularType2) == false);
assertTrue("should not be equal, they have different index names",
tabularType2.equals(tabularType) == false);
}