k-joseph

Untitled

Aug 2nd, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. /**
  2. * The contents of this file are subject to the OpenMRS Public License
  3. * Version 1.0 (the "License"); you may not use this file except in
  4. * compliance with the License. You may obtain a copy of the License at
  5. * http://license.openmrs.org
  6. *
  7. * Software distributed under the License is distributed on an "AS IS"
  8. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  9. * License for the specific language governing rights and limitations
  10. * under the License.
  11. *
  12. * Copyright (C) OpenMRS, LLC. All Rights Reserved.
  13. */
  14. package org.openmrs.api;
  15.  
  16. import static junit.framework.Assert.assertEquals;
  17. import static junit.framework.Assert.assertNotNull;
  18. import static junit.framework.Assert.assertTrue;
  19. import junit.framework.Assert;
  20.  
  21. import org.junit.Test;
  22. import org.openmrs.api.context.Context;
  23. import org.openmrs.notification.Note;
  24. import org.openmrs.notification.NoteService;
  25. import org.openmrs.test.BaseContextSensitiveTest;
  26. import org.openmrs.test.Verifies;
  27.  
  28. @SuppressWarnings("deprecation")
  29. public class NoteServiceTest extends BaseContextSensitiveTest {
  30.  
  31. protected static final String INITIAL_NOTE_XML = "org/openmrs/api/include/NoteServiceTest-initial.xml";
  32.  
  33. /**
  34. * @see {@link NoteService#voidNote(Note,String)}
  35. */
  36. @Test
  37. @Verifies(value = "should void the Note and set the voidReason", method = "voidNote(Note,String)")
  38. public void voidNote_shouldVoidTheNoteAndSetTheVoidReason() throws Exception {
  39. executeDataSet(INITIAL_NOTE_XML);
  40.  
  41. NoteService noteService = Context.getNoteService();
  42.  
  43. Note note = noteService.getNote(8);
  44.  
  45. Assert.assertFalse(note.isVoided());
  46. Assert.assertNull(note.getVoidReason());
  47. Assert.assertNull(note.getDateVoided());
  48. Assert.assertNull(note.getDateVoided());
  49.  
  50. noteService.voidNote(note, "test reason");
  51.  
  52. assertTrue(note.isVoided());
  53. assertEquals("test reason", note.getVoidReason());
  54. assertEquals(Context.getAuthenticatedUser(), note.getVoidedBy());
  55. assertNotNull(note.getDateVoided());
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment