Advertisement
Guest User

Untitled

a guest
Apr 7th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package org.openmrs.api.db;
  2.  
  3. import static junit.framework.Assert.assertEquals;
  4. import static junit.framework.Assert.assertTrue;
  5. import junit.framework.Assert;
  6.  
  7. import org.junit.Test;
  8. import org.openmrs.api.APIException;
  9. import org.openmrs.notification.Note;
  10. import org.openmrs.test.BaseContextSensitiveTest;
  11. import org.openmrs.test.Verifies;
  12.  
  13. public class HibernateNoteDAOTest extends BaseContextSensitiveTest{
  14.  
  15. private NoteDAO dao;
  16. private Note note;
  17.  
  18. @Test
  19. @Verifies(value = "should void the Note and set the voidReason", method = "voidNote(Note,String)")
  20. public void voidNote_shouldVoidTheNoteAndSetTheVoidReason() throws APIException {
  21. try {
  22. note = dao.getNote(1);
  23. Assert.assertFalse(note.getVoided());
  24. Assert.assertNull(note.getVoidReason());
  25. } catch (NullPointerException e1) {
  26. e1.printStackTrace();
  27. }
  28.  
  29. try {
  30. note = dao.voidNote(note, "test reason");
  31. assertTrue(note.getVoided());
  32. assertEquals("test reason", note.getVoidReason());
  33. } catch (NullPointerException e) {
  34. e.printStackTrace();
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement