Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ public Paragraph insertNewParagraph(int index, AuthenticationInfo authentication
private Paragraph createParagraph(int index, AuthenticationInfo authenticationInfo) {
Paragraph p = new Paragraph(this, this, factory, interpreterSettingManager);
p.setAuthenticationInfo(authenticationInfo);
p.addUser(p, p.getUser());
setParagraphMagic(p, index);
return p;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,20 @@ public void getNameWithoutNameItself() {

assertEquals("getName should return same as getId when name is empty", note.getId(), note.getName());
}

@Test
public void personalizedModeReturnDifferentParagraphInstancePerUser() {
Note note = new Note(repo, interpreterFactory, interpreterSettingManager, jobListenerFactory, index, credentials, noteEventListener);

String user1 = "user1";
String user2 = "user2";
note.setPersonalizedMode(true);
note.addNewParagraph(new AuthenticationInfo(user1));
Paragraph baseParagraph = note.getParagraphs().get(0);
Paragraph user1Paragraph = baseParagraph.getUserParagraph(user1);
Paragraph user2Paragraph = baseParagraph.getUserParagraph(user2);
assertNotEquals(System.identityHashCode(baseParagraph), System.identityHashCode(user1Paragraph));
assertNotEquals(System.identityHashCode(baseParagraph), System.identityHashCode(user2Paragraph));
assertNotEquals(System.identityHashCode(user1Paragraph), System.identityHashCode(user2Paragraph));
}
}