@Test public void equalsUsingPk() { Document model1 = new Document(); Document model2 = new Document(); String id = ValueGenerator.getUniqueString(32); model1.setId(id); model2.setId(id); model1.setDocumentContentType("a"); model2.setDocumentContentType("a"); model1.setDocumentSize(1); model2.setDocumentSize(1); model1.setDocumentFileName("a"); model2.setDocumentFileName("a"); model1.setDocumentBinary("d".getBytes()); model2.setDocumentBinary("d".getBytes()); model1.setVersion(1); model2.setVersion(1); assertTrue(model1.isIdSet()); assertTrue(model2.isIdSet()); assertTrue(model1.hashCode() == model2.hashCode()); assertTrue(model1.equals(model2)); assertTrue(model2.equals(model1)); }
@Test public void isIdSetReturnsTrue() { Document model = new Document(); model.setId(ValueGenerator.getUniqueString(32)); assertNotNull(model.getId()); assertTrue(model.isIdSet()); }
// test unique primary key @Test public void newInstanceHasNoPrimaryKey() { Document model = new Document(); assertFalse(model.isIdSet()); }