Guest User

Untitled

a guest
Dec 26th, 2024
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. @Test
  2. public void getNotesOrderedByTypeAndLastUpdated_shouldReturnNotesInCorrectOrder() {
  3. Note note1 = new Note();
  4. note1.setReferenceId("1");
  5. note1.setReferenceTableId("1");
  6. note1.setNoteType(Note.EXTERNAL);
  7. note1.setSubject("First Note");
  8. note1.setText("This is the first test note.");
  9. note1.setSysUserId("testUser123");
  10. System.out.println("Inserting note1: " + note1);
  11. noteService.insert(note1);
  12.  
  13. Note note2 = new Note();
  14. note2.setReferenceId("1");
  15. note2.setReferenceTableId("1");
  16. note2.setNoteType(Note.INTERNAL);
  17. note2.setSubject("Second Note");
  18. note2.setText("This is the second test note.");
  19. note2.setSysUserId("testUser456");
  20. System.out.println("Inserting note2: " + note2);
  21. noteService.insert(note2);
  22.  
  23. List<Note> notes = noteService.getAllNotesByRefIdRefTable(note1);
  24. System.out.println("Retrieved notes: " + notes);
  25.  
  26. assertFalse("Notes list should not be empty", notes.isEmpty());
  27. System.out.println("Notes list is not empty.");
  28.  
  29. assertEquals("Second note should be internal", Note.INTERNAL, notes.get(0).getNoteType());
  30. System.out.println("First note's type is correct: " + notes.get(0).getNoteType());
  31.  
  32. assertEquals("First note should be external", Note.EXTERNAL, notes.get(1).getNoteType());
  33. System.out.println("Second note's type is correct: " + notes.get(1).getNoteType());
  34. }
Advertisement
Add Comment
Please, Sign In to add comment