Advertisement
gauravpaliwal

Untitled

Jul 21st, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 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.  
  15. package org.openmrs.module.feedback.web;
  16.  
  17. import org.openmrs.test.BaseModuleContextSensitiveTest;
  18. import org.openmrs.test.BaseContextSensitiveTest;
  19. import org.springframework.mock.web.MockHttpSession;
  20. import org.springframework.mock.web.MockHttpServletResponse;
  21. import org.openmrs.api.context.Context;
  22. import org.openmrs.module.feedback.FeedbackService ;
  23.  
  24.  
  25. import java.util.Map;
  26. import javax.servlet.http.HttpServletRequest;
  27. import org.openmrs.web.controller.person.PersonFormController;
  28. import org.testng.annotations.AfterClass;
  29. import org.testng.annotations.BeforeClass;
  30. import org.testng.annotations.Test;
  31.  
  32. import org.springframework.mock.web.MockHttpServletRequest;
  33. import org.springframework.web.servlet.ModelAndView;
  34.  
  35. import static org.junit.Assert.assertEquals;
  36.  
  37.  
  38. public class AddFeedbackFormControllerTest extends BaseModuleContextSensitiveTest {
  39.  
  40.  
  41.  
  42.  
  43. @BeforeClass
  44. public void setUp() {
  45. // code that will be invoked before this test starts
  46. }
  47.  
  48. @Test
  49. public void aTest() {
  50. System.out.println("Test");
  51. }
  52.  
  53. @Test
  54. public void testFormBackingObject() throws Exception {
  55. System.out.println("formBackingObject");
  56. MockHttpServletRequest request = new MockHttpServletRequest();
  57. MockHttpServletResponse response = new MockHttpServletResponse(); ;
  58. ModelAndView mv;
  59. HttpServletRequest req = null;
  60. /*AddFeedbackFormController instance = new AddFeedbackFormController(); */
  61. AddFeedbackFormController instance = new AddFeedbackFormController() ;
  62. request.setSession(new MockHttpSession(null));
  63. request.setMethod("POST") ;
  64. request.addParameter("predefinedSubject", "Testing");
  65. mv = instance.handleRequest(request, response) ;
  66. Boolean result = instance.formBackingObject(request);
  67. System.out.println(instance.getFormView()) ;
  68. System.out.println("paliwal") ;
  69. System.out.println(result) ;
  70. /*Boolean expResult = null;
  71. assertEquals(expResult, result);*/
  72.  
  73. }
  74.  
  75. @Test
  76. public void testReferenceData() throws Exception {
  77. System.out.println("referenceData");
  78. HttpServletRequest req = null;
  79. AddFeedbackFormController instance = new AddFeedbackFormController();
  80. Map expResult = null;
  81. Map result = instance.referenceData(req);
  82. assertEquals(expResult, result);
  83. // TODO review the generated test code and remove the default call to fail.
  84. }
  85.  
  86. @AfterClass
  87. public void cleanUp() {
  88. // code that will be invoked after this test ends
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement