Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.openmrs.api.db;
- import static junit.framework.Assert.assertEquals;
- import static junit.framework.Assert.assertTrue;
- import junit.framework.Assert;
- import org.junit.Test;
- import org.openmrs.api.APIException;
- import org.openmrs.notification.Note;
- import org.openmrs.test.BaseContextSensitiveTest;
- import org.openmrs.test.Verifies;
- public class HibernateNoteDAOTest extends BaseContextSensitiveTest{
- private NoteDAO dao;
- private Note note;
- @Test
- @Verifies(value = "should void the Note and set the voidReason", method = "voidNote(Note,String)")
- public void voidNote_shouldVoidTheNoteAndSetTheVoidReason() throws APIException {
- try {
- note = dao.getNote(1);
- Assert.assertFalse(note.getVoided());
- Assert.assertNull(note.getVoidReason());
- } catch (NullPointerException e1) {
- e1.printStackTrace();
- }
- try {
- note = dao.voidNote(note, "test reason");
- assertTrue(note.getVoided());
- assertEquals("test reason", note.getVoidReason());
- } catch (NullPointerException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement