Skip to content

Commit d66a9bd

Browse files
committed
Updated asserts for testing equals() method in DocumentLink.java and HibernateDocumentNoteDAO.java
1 parent 9a6bdf3 commit d66a9bd

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

logicaldoc-core/src/test/java/com/logicaldoc/core/document/DocumentLinkTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ public void testEquals() throws PersistenceException {
9999
link2.setDocument2(doc2);
100100

101101
assertEquals(link1, link1);
102-
assertNotSame(link2, link1);
103-
assertNotSame(link1, link2);
102+
assertEquals(false, link2.equals(link1));
103+
assertEquals(false, link1.equals(link2));
104104

105105
link2 = null;
106-
assertNotSame(link1, link2);
106+
assertEquals(false, link1.equals(link2));
107107

108108
link1 = new DocumentLink();
109109
link1.setDocument1(null);
@@ -114,15 +114,15 @@ public void testEquals() throws PersistenceException {
114114
link2.setDocument2(doc3);
115115
DocumentLink link3 = new DocumentLink();
116116
link3.setDocument2(doc2);
117-
assertNotSame(link2, link3);
117+
assertEquals(false, link2.equals(link3));
118118

119119
link1 = new DocumentLink();
120120
link1.setType("linkType1");
121121
assertNotNull(link1.getType());
122122
link2 = new DocumentLink();
123123
link2.setType("linkType2");
124124
assertNotNull(link2.getType());
125-
assertNotSame(link1, link2);
126-
assertNotSame(link2, link1);
125+
assertEquals(false, link1.equals(link2));
126+
assertEquals(false, link2.equals(link1));
127127
}
128128
}

logicaldoc-core/src/test/java/com/logicaldoc/core/document/HibernateDocumentNoteDAOTest.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,37 +70,38 @@ public void testEquals() throws PersistenceException {
7070

7171
String notANote = "Not a DocumentNote";
7272

73-
assertNotSame(note1, note2);
73+
assertEquals(false, note1.equals(note2));
7474

7575
note2.setId(note1.getId());
76-
assertNotSame(note1, note2);
76+
assertEquals(false, note1.equals(note2));
7777

7878
note1.setDate(null);
79-
assertNotSame(note1, note2);
79+
assertEquals(false, note1.equals(note2));
8080

8181
note1.setDate(new Date());
8282
assertNotSame(note1, note2);
83+
assertEquals(false, note1.equals(note2));
8384

8485
assertEquals(note1, note1);
8586

8687
DocumentNote nullNote = null;
87-
assertNotSame(note1, nullNote);
88-
assertNotSame(note1, new Object());
89-
assertNotSame(note1, notANote);
88+
assertEquals(false, note1.equals(nullNote));
89+
assertEquals(false, note1.equals(new Object()));
90+
assertEquals(false, note1.equals(notANote));
9091

9192
note1 = dao.findById(1);
9293
note2 = dao.findById(2);
9394
assertEquals(note1.getDate(), note2.getDate());
9495

9596
note2.setDate(null);
96-
assertNotSame(note1.getDate(), note2.getDate());
97-
assertNotSame(note2, note1);
97+
assertEquals(false, note1.getDate().equals(note2.getDate()));
98+
assertEquals(false, note1.equals(note2));
9899

99100
note1 = dao.findById(1);
100101
note2 = dao.findById(2);
101102
note2.setFileVersion(null);
102-
assertNotSame(note1.getFileVersion(), note2.getFileVersion());
103-
assertNotSame(note2, note1);
103+
assertEquals(false, note1.getFileVersion().equals(note2.getFileVersion()));
104+
assertEquals(false, note1.equals(note2));
104105
}
105106

106107
@Test

0 commit comments

Comments
 (0)