@Test public void testTabularResult() { HeaderDefinition headerDefinition1 = HeaderDefinition.of("A", "B", "C", "D"); HeaderDefinition headerDefinition2 = HeaderDefinition.of("A", "B", "C", "D"); HeaderDefinition headerDefinition3 = HeaderDefinition.of("B", "A", "C", "D"); Row row1 = Row.of(headerDefinition1, new String[] {"Jim", "Miranda", "1.2", "2009-09-13" }); Row row2 = Row.of(headerDefinition1, new String[] {"Jim", "Miranda", "1.2", "2009-09-13" }); Row row3 = Row.of(headerDefinition2, new String[] {"Jim", "Miranda", "Elaine", "Kostas" }); Row row4 = Row.of(headerDefinition3, new String[] {"Jim", "Miranda", "Elaine", "Kostas" }); TabularResult tr1 = TabularResult.of(headerDefinition1, Arrays.asList(row1, row3)); Assert.assertEquals(tr1, tr1); Assert.assertEquals(tr1.hashCode(), tr1.hashCode()); Assert.assertNotEquals(null, tr1); TabularResult tr2 = TabularResult.of(headerDefinition2, Arrays.asList(row2, row4)); Assert.assertNotEquals(tr1, tr2); Assert.assertNotEquals(tr1.hashCode(), tr2.hashCode()); TabularResult tr3 = TabularResult.of(headerDefinition2, Arrays.asList(row2, row1)); Assert.assertNotEquals(tr2, tr3); Assert.assertNotEquals(tr2.hashCode(), tr3.hashCode()); }
@Test public void testTabularResult() { HeaderDefinition headerDefinition1 = HeaderDefinition.of("A", "B", "C", "D"); HeaderDefinition headerDefinition2 = HeaderDefinition.of("A", "B", "C", "D"); HeaderDefinition headerDefinition3 = HeaderDefinition.of("B", "A", "C", "D"); Row row1 = Row.of(headerDefinition1, new String[] {"Jim", "Miranda", "1.2", "2009-09-13" }); Row row2 = Row.of(headerDefinition1, new String[] {"Jim", "Miranda", "1.2", "2009-09-13" }); Row row3 = Row.of(headerDefinition2, new String[] {"Jim", "Miranda", "Elaine", "Kostas" }); Row row4 = Row.of(headerDefinition3, new String[] {"Jim", "Miranda", "Elaine", "Kostas" }); TabularResult tr1 = TabularResult.of(headerDefinition1, Arrays.asList(row1, row3)); Assert.assertEquals(tr1, tr1); Assert.assertEquals(tr1.hashCode(), tr1.hashCode()); Assert.assertNotEquals(null, tr1); TabularResult tr2 = TabularResult.of(headerDefinition2, Arrays.asList(row2, row4)); Assert.assertNotEquals(tr1, tr2); Assert.assertNotEquals(tr1.hashCode(), tr2.hashCode()); TabularResult tr3 = TabularResult.of(headerDefinition2, Arrays.asList(row2, row1)); Assert.assertNotEquals(tr2, tr3); Assert.assertNotEquals(tr2.hashCode(), tr3.hashCode()); }