Produced by Araxis Merge on 2/4/2019 11:34:05 AM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | MHPRO_v1.x.zip\mhpro-resources-master@a26412b610c.zip\ws\src\test\java\gov\va\mobile\vamf\mhpro\resource | VirtualDeleteMultipleProviderControllerTest.java | Tue Nov 14 19:31:17 2017 UTC |
| 2 | MHPRO_v1.x.zip\mhpro-resources-master@a26412b610c.zip\ws\src\test\java\gov\va\mobile\vamf\mhpro\resource | VirtualDeleteMultipleProviderControllerTest.java | Fri Feb 1 19:27:42 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 968 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package go v.va.mobil e.vamf.mhp ro.resourc e; | |
| 2 | ||
| 3 | import sta tic org.ha mcrest.Mat cherAssert .assertTha t; | |
| 4 | import sta tic org.ha mcrest.Mat chers.cont ainsString ; | |
| 5 | import sta tic org.ju nit.Assert .assertFal se; | |
| 6 | import sta tic org.ju nit.Assert .assertTru e; | |
| 7 | import sta tic org.mo ckito.Matc hers.any; | |
| 8 | import sta tic org.mo ckito.Mock ito.when; | |
| 9 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.delete; | |
| 10 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.get; | |
| 11 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status; | |
| 12 | ||
| 13 | import jav a.util.Arr ayList; | |
| 14 | import jav a.util.Dat e; | |
| 15 | import jav a.util.Lis t; | |
| 16 | ||
| 17 | import org .joda.time .DateTime; | |
| 18 | import org .junit.Aft er; | |
| 19 | import org .junit.Bef ore; | |
| 20 | import org .junit.Tes t; | |
| 21 | import org .junit.run ner.RunWit h; | |
| 22 | import org .mockito.M ock; | |
| 23 | import org .mockito.M ockitoAnno tations; | |
| 24 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 25 | import org .springfra mework.htt p.MediaTyp e; | |
| 26 | import org .springfra mework.tes t.context. ContextCon figuration ; | |
| 27 | import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ; | |
| 28 | import org .springfra mework.tes t.context. web.WebApp Configurat ion; | |
| 29 | import org .springfra mework.tes t.util.Ref lectionTes tUtils; | |
| 30 | import org .springfra mework.tes t.web.serv let.MvcRes ult; | |
| 31 | ||
| 32 | import com .agilex.he althcare.m obilehealt hplatform. domain.Mhp User; | |
| 33 | import com .agilex.he althcare.m obilehealt hplatform. domain.Pat ientIdenti fier; | |
| 34 | import com .google.gs on.Gson; | |
| 35 | import com .google.gs on.GsonBui lder; | |
| 36 | ||
| 37 | import gov .va.mobile .vamf.comm on.ecrud.u til.DateUt ils; | |
| 38 | import gov .va.mobile .vamf.mhpr o.datalaye r.Assessme ntReposito ry; | |
| 39 | import gov .va.mobile .vamf.mhpr o.datalaye r.Assignme ntReposito ry; | |
| 40 | import gov .va.mobile .vamf.mhpr o.datalaye r.EventRep ository; | |
| 41 | import gov .va.mobile .vamf.mhpr o.domain.A nswer; | |
| 42 | import gov .va.mobile .vamf.mhpr o.domain.A ssessment; | |
| 43 | import gov .va.mobile .vamf.mhpr o.domain.A ssignment; | |
| 44 | import gov .va.mobile .vamf.mhpr o.domain.E vent; | |
| 45 | import gov .va.mobile .vamf.mhpr o.domain.F ormat; | |
| 46 | import gov .va.mobile .vamf.mhpr o.domain.R esponse; | |
| 47 | import gov .va.mobile .vamf.mhpr o.domain.R esponseSec tion; | |
| 48 | import gov .va.mobile .vamf.mhpr o.domain.S coreMetaDa ta; | |
| 49 | import gov .va.mobile .vamf.mhpr o.service. ICurrentUs erService; | |
| 50 | import gov .va.mobile .vamf.mhpr o.service. impl.MVICo nversionSe rvice; | |
| 51 | ||
| 52 | /** | |
| 53 | * The Cla ss Virtual DeleteMult ipleProvid erControll erTest. | |
| 54 | * | |
| 55 | * @author PII | |
| 56 | * | |
| 57 | */ | |
| 58 | @RunWith(S pringJUnit 4ClassRunn er.class) | |
| 59 | @WebAppCon figuration | |
| 60 | @ContextCo nfiguratio n({ "class path:appli cationCont ext.xml", "classpath :dispatche r-servlet. xml","clas spath:mong oContext.x ml" }) | |
| 61 | ||
| 62 | public cla ss Virtual DeleteMult ipleProvid erControll erTest ext ends Abstr actMVCCont rollerTest er { | |
| 63 | ||
| 64 | @A utowired | |
| 65 | pr ivate Assi gnmentReso urce contr oller; | |
| 66 | ||
| 67 | /* * The user service. */ | |
| 68 | @M ock | |
| 69 | pr ivate ICur rentUserSe rvice user Service; | |
| 70 | ||
| 71 | @M ock | |
| 72 | pr ivate MVIC onversionS ervice mvi Conversion Service; | |
| 73 | ||
| 74 | /* * The even t reposito ry. */ | |
| 75 | @A utowired | |
| 76 | pr ivate Even tRepositor y eventRep ository; | |
| 77 | ||
| 78 | /* * The asse ssment rep ository. * / | |
| 79 | @A utowired | |
| 80 | pr ivate Asse ssmentRepo sitory ass essmentRep ository; | |
| 81 | ||
| 82 | /* * The assi gnment rep ository. * / | |
| 83 | @A utowired | |
| 84 | pr ivate Assi gnmentRepo sitory ass ignmentRep ository; | |
| 85 | ||
| 86 | /* * The user . */ | |
| 87 | pr ivate MhpU ser user; | |
| 88 | ||
| 89 | /* * The asse ssment ids . */ | |
| 90 | pr ivate stat ic List<St ring> asse ssmentIds = new Arra yList<Stri ng>(); | |
| 91 | ||
| 92 | /* * The assi gnment ids . */ | |
| 93 | pr ivate stat ic List<St ring> assi gnmentIds = new Arra yList<Stri ng>(); | |
| 94 | ||
| 95 | /* * The pati ent id. */ | |
| 96 | pr ivate stat ic String patientId = "6660000 01"; | |
| 97 | ||
| 98 | /* * user id who ended assignment */ | |
| 99 | pr ivate stat ic String ENDED_BY_U SER_ID = " logged-in- user-provi derId"; | |
| 100 | pr ivate stat ic String LOGGED_IN_ USER_ASSIG N_AUTH = " logged-in- user-Provi derAssignA uth"; | |
| 101 | ||
| 102 | /* * The asse ssment id. */ | |
| 103 | pr ivate stat ic String assessment Id; | |
| 104 | ||
| 105 | /* * The assi gnment id. */ | |
| 106 | pr ivate stat ic String assignment Id; | |
| 107 | ||
| 108 | pr ivate stat ic String ASSESSMENT _NAME_TEST _1 = "GAD- 7"; | |
| 109 | pr ivate stat ic String ASSESSMENT _NAME_TEST _2 = "PCL- 5"; | |
| 110 | pr ivate stat ic String ASSESSMENT _NAME_TEST _3 = "PHQ- 9"; | |
| 111 | pr ivate stat ic String ASSESSMENT _NAME_TEST _4 = "GAD- 7"; | |
| 112 | pr ivate stat ic String ASSIGNMENT _PROVIDER_ ASSIGN_AUT H = "EDIPI "; | |
| 113 | pr ivate stat ic String ASSIGNMENT _PROVIDER_ ID = patie ntId; | |
| 114 | ||
| 115 | pr ivate stat ic String RECURRING_ FREQUENCY = "once"; | |
| 116 | pr ivate stat ic int NUM BER_REMAIN ING = 3; | |
| 117 | pr ivate stat ic String DOC_LAST_M ODIFIED_BY = "docLas tModifiedB y"; | |
| 118 | pr ivate stat ic Date DO C_UPDATED_ DATE = new Date(); | |
| 119 | ||
| 120 | /* * | |
| 121 | * Sets up t est data. | |
| 122 | * | |
| 123 | * @throws E xception | |
| 124 | * the exc eption | |
| 125 | * / | |
| 126 | @B efore | |
| 127 | pu blic void setUp() th rows Excep tion { | |
| 128 | Mock itoAnnotat ions.initM ocks(this) ; | |
| 129 | ||
| 130 | // Refl ectionTest Utils.setF ield(contr oller, "us erService" , userServ ice); | |
| 131 | } | |
| 132 | ||
| 133 | pr otected vo id createT estData(St ring asses smentName) { | |
| 134 | // S ystem.out. println("\ n"+assessm entName); | |
| 135 | ||
| 136 | Gson Builder bu ilder = ne w GsonBuil der(); | |
| 137 | buil der.setDat eFormat(Da teUtils.DA TE_FORMAT_ NO_MS); | |
| 138 | ||
| 139 | Asse ssment ass essment = new Assess ment(); | |
| 140 | asse ssment.set PatientId( patientId) ; | |
| 141 | asse ssment.set PatientAss ignAuth("E DIPI"); | |
| 142 | asse ssment.set Assessment Name(asses smentName) ; | |
| 143 | asse ssment.set ProviderId (patientId ); | |
| 144 | asse ssment.set Completed( Boolean.TR UE); | |
| 145 | Date Time today = new Dat eTime(); | |
| 146 | Date Time start Date = tod ay.minusDa ys(4); | |
| 147 | Date Time endDa te = today .plusDays( 5); | |
| 148 | asse ssment.set StartDate( startDate) ; | |
| 149 | asse ssment.set EndDate(en dDate); | |
| 150 | ||
| 151 | // c reate assi gnments | |
| 152 | Assi gnment ass ignment1 = this.crea teAssignme nt(); | |
| 153 | assi gnmentRepo sitory.sav e(assignme nt1); | |
| 154 | assi gnmentIds. add(assign ment1.get_ id()); | |
| 155 | ||
| 156 | Assi gnment ass ignment = this.creat eAssignmen t(); | |
| 157 | assi gnmentRepo sitory.sav e(assignme nt); | |
| 158 | assi gnmentIds. add(assign ment.get_i d()); | |
| 159 | assi gnmentId = assignmen t.get_id() ; | |
| 160 | asse ssment.set _assignmen tId(assign ment.get_i d()); | |
| 161 | ||
| 162 | Resp onseSectio n response Section = new Respon seSection( ); | |
| 163 | List <Answer> a nswers = n ew ArrayLi st<Answer> (); | |
| 164 | resp onseSectio n.setAnswe rs(answers ); | |
| 165 | List <ResponseS ection> li stSections = new Arr ayList<Res ponseSecti on>(); | |
| 166 | list Sections.a dd(respons eSection); | |
| 167 | Resp onse respo nse = new Response() ; | |
| 168 | resp onse.setSe ctions(lis tSections) ; | |
| 169 | resp onse.setDa teSubmitte d(DateTime .now()); | |
| 170 | asse ssment.set Response(r esponse); | |
| 171 | ||
| 172 | List <ScoreMeta Data> scor eMetaDataL ist = new ArrayList< ScoreMetaD ata>(); | |
| 173 | Form at format = new Form at(); | |
| 174 | asse ssment.set Format(for mat); | |
| 175 | asse ssment.get Format().s etScoreMet aDataList( scoreMetaD ataList); | |
| 176 | ||
| 177 | asse ssmentRepo sitory.sav e(assessme nt); | |
| 178 | asse ssmentId = assessmen t.get_id() ; | |
| 179 | asse ssmentIds. add(assess ment.get_i d()); | |
| 180 | ||
| 181 | asse ssment.set ProviderAs signAuth(" EDIPI"); | |
| 182 | asse ssment.set ProviderId (patientId ); | |
| 183 | ||
| 184 | asse ssmentRepo sitory.sav e(assessme nt); | |
| 185 | } | |
| 186 | ||
| 187 | pr otected Pa tientIdent ifier crea teUser(Str ing unique Id, String assigning Authority) { | |
| 188 | user = new Mhp User(); | |
| 189 | Pati entIdentif ier identi fier = new PatientId entifier() ; | |
| 190 | // i dentifier. setAssigni ngAuthorit y("EDIPI") ; //fails - results in 401 | |
| 191 | // e rror | |
| 192 | iden tifier.set AssigningA uthority(a ssigningAu thority); | |
| 193 | iden tifier.set UniqueId(u niqueId); | |
| 194 | ||
| 195 | Refl ectionTest Utils.setF ield(user, "userIden tifier", i dentifier) ; | |
| 196 | ||
| 197 | when (userServi ce.getUser ()).thenRe turn(user) ; | |
| 198 | when (mviConver sionServic e.convertP atientDfnT oEdipi(any (String.cl ass), any( String.cla ss))) | |
| 199 | .thenRet urn(identi fier); | |
| 200 | ||
| 201 | retu rn identif ier; | |
| 202 | } | |
| 203 | ||
| 204 | /* * | |
| 205 | * Tear down . | |
| 206 | * | |
| 207 | * @throws E xception | |
| 208 | * the exc eption | |
| 209 | * / | |
| 210 | @A fter | |
| 211 | pu blic void tearDown() throws Ex ception { | |
| 212 | // T ODO uncomm ent before checking in | |
| 213 | dele teFromDB() ; | |
| 214 | } | |
| 215 | ||
| 216 | pr otected vo id deleteF romDB() { | |
| 217 | for (String id : assessm entIds) { | |
| 218 | assess mentReposi tory.delet e(id); | |
| 219 | } | |
| 220 | ||
| 221 | //fo r (String id : assig nmentIds) { | |
| 222 | // assign mentReposi tory.delet e(id); | |
| 223 | //} | |
| 224 | clea nupAssignm entData(as signmentId s); | |
| 225 | ||
| 226 | // d elete even ts created by these tests | |
| 227 | List <Event> ev entList = eventRepos itory.find All(); | |
| 228 | List <Event> ev entsDelete List = new ArrayList <Event>(); | |
| 229 | ||
| 230 | for (Event ev : eventLis t) { | |
| 231 | if (AS SESSMENT_N AME_TEST_1 .equals(ev .getAssess mentName() )) { | |
| 232 | eventsDe leteList.a dd(ev); | |
| 233 | } else if (ASSES SMENT_NAME _TEST_2.eq uals(ev.ge tAssessmen tName())) { | |
| 234 | eventsDe leteList.a dd(ev); | |
| 235 | } else if (ASSES SMENT_NAME _TEST_3.eq uals(ev.ge tAssessmen tName())) { | |
| 236 | eventsDe leteList.a dd(ev); | |
| 237 | } else if (ASSES SMENT_NAME _TEST_4.eq uals(ev.ge tAssessmen tName())) { | |
| 238 | eventsDe leteList.a dd(ev); | |
| 239 | } | |
| 240 | } | |
| 241 | ||
| 242 | for (Event eve nt : event sDeleteLis t) { | |
| 243 | // Sys tem.out.pr intln("del ete event with asses smentName: | |
| 244 | // "+e vent.getAs sessmentNa me()); | |
| 245 | eventR epository. delete(eve nt); | |
| 246 | } | |
| 247 | } | |
| 248 | ||
| 249 | pr ivate void cleanupAs signmentDa ta(List<St ring> ids) { | |
| 250 | for (String as signmentId : ids) { | |
| 251 | Assign ment assig nment = as signmentRe pository.f indBy_id(a ssignmentI d); | |
| 252 | if (as signment ! = null) { | |
| 253 | List<Str ing> asses smentIds = assignmen t.get_asse ssmentIds( ); | |
| 254 | for (Str ing id : a ssessmentI ds) { | |
| 255 | Assessment assessmen t = assess mentReposi tory.findB y_id(id); | |
| 256 | if (assess ment != nu ll) { | |
| 257 | if (assessme nt.get_due EventId() != null) { | |
| 258 | even tRepositor y.delete(a ssessment. get_dueEve ntId()); | |
| 259 | } | |
| 260 | as sessmentRe pository.d elete(asse ssment); | |
| 261 | } | |
| 262 | ||
| 263 | } | |
| 264 | List<Eve nt> list = eventRepo sitory.fin dBy_assign mentId(ass ignment.ge t_id()); | |
| 265 | if (list != null & & list.siz e() > 0) { | |
| 266 | for (Event e : list) { | |
| 267 | ev entReposit ory.delete (e); | |
| 268 | } | |
| 269 | } | |
| 270 | ||
| 271 | assignme ntReposito ry.delete( assignment ); | |
| 272 | } | |
| 273 | } | |
| 274 | ||
| 275 | } | |
| 276 | ||
| 277 | /* * | |
| 278 | * Test virt ual delete on multip le provide r assignme nt. | |
| 279 | * | |
| 280 | * set logge d in user assigningA uthority t o be DIFFE RENT than assignment | |
| 281 | * assigning Authority => succeed | |
| 282 | * | |
| 283 | * Verify MH PRO-5067 - expects v irtual del ete to cre ate assign ment event | |
| 284 | * | |
| 285 | * @throws E xception | |
| 286 | * the exc eption | |
| 287 | * / | |
| 288 | @T est | |
| 289 | pu blic void testVirtua lDeleteMul tipleProvi derAssignm ent() thro ws Excepti on { | |
| 290 | ||
| 291 | crea teUser(END ED_BY_USER _ID, LOGGE D_IN_USER_ ASSIGN_AUT H); | |
| 292 | crea teTestData (ASSESSMEN T_NAME_TES T_1); | |
| 293 | ||
| 294 | MvcR esult resu lt = mockM vc | |
| 295 | .perform (delete(As signmentRe source.REQ UEST_PROVI DER_ASSIGH MENT_ID_MA PPING, | |
| 296 | "E DIPI",ENDE D_BY_USER_ ID, assign mentId) | |
| 297 | .c ontentType (MediaType .APPLICATI ON_JSON)) | |
| 298 | .andExpe ct(status( ).isOk()). andReturn( ); | |
| 299 | ||
| 300 | Stri ng respons eBody = re sult.getRe sponse().g etContentA sString(); | |
| 301 | asse rtTrue(res ponseBody. equals("") ); | |
| 302 | ||
| 303 | List <Event> ev ents = eve ntReposito ry.findAll (); | |
| 304 | ||
| 305 | asse rtTrue(eve nts.size() > 0); | |
| 306 | ||
| 307 | for (Event eve nt : event s) { | |
| 308 | if (AS SESSMENT_N AME_TEST_1 .equals(ev ent.getAss essmentNam e())) { | |
| 309 | assertTr ue(event ! = null); | |
| 310 | assertTh at(event.g etRecurren ceFrequenc y(), conta insString( RECURRING_ FREQUENCY) ); | |
| 311 | assertTr ue((event. getNumberR emaining() == NUMBER _REMAINING )); | |
| 312 | assertFa lse((event .getEndedO n() == nul l)); | |
| 313 | assertTh at(event.g etEndedByP roviderId( ), contain sString(EN DED_BY_USE R_ID)); | |
| 314 | assertTh at(event.g etAssessme ntName(), containsSt ring(ASSES SMENT_NAME _TEST_1)); | |
| 315 | ||
| 316 | break; | |
| 317 | } | |
| 318 | } | |
| 319 | } | |
| 320 | ||
| 321 | /* * | |
| 322 | * Test virt ual delete on multip le provide r assignme nt. | |
| 323 | * | |
| 324 | * set logge d in user assigningA uthority t o be SAME as than as signment | |
| 325 | * assigning Authority but user i d's are di fferent => succeed | |
| 326 | * | |
| 327 | * Verify MH PRO-5067 - expects v irtual del ete to cre ate assign ment event | |
| 328 | * | |
| 329 | * @throws E xception | |
| 330 | * the exc eption | |
| 331 | * / | |
| 332 | @T est | |
| 333 | pu blic void testVirtua lDeleteMul tipleProvi derAssignm ent_2() th rows Excep tion { | |
| 334 | ||
| 335 | crea teUser(END ED_BY_USER _ID, ASSIG NMENT_PROV IDER_ASSIG N_AUTH); | |
| 336 | crea teTestData (ASSESSMEN T_NAME_TES T_2); | |
| 337 | ||
| 338 | MvcR esult resu lt = mockM vc | |
| 339 | .perform (delete(As signmentRe source.REQ UEST_PROVI DER_ASSIGH MENT_ID_MA PPING, | |
| 340 | "E DIPI",ENDE D_BY_USER_ ID, assign mentId) | |
| 341 | .c ontentType (MediaType .APPLICATI ON_JSON)) | |
| 342 | .andExpe ct(status( ).isOk()). andReturn( ); | |
| 343 | ||
| 344 | Stri ng respons eBody = re sult.getRe sponse().g etContentA sString(); | |
| 345 | asse rtTrue(res ponseBody. equals("") ); | |
| 346 | ||
| 347 | List <Event> ev ents = eve ntReposito ry.findAll (); | |
| 348 | ||
| 349 | asse rtTrue(eve nts.size() > 0); | |
| 350 | Even t event = null; | |
| 351 | for (Event ev : events) { | |
| 352 | if (AS SESSMENT_N AME_TEST_2 .equals(ev .getAssess mentName() )) { | |
| 353 | event = ev; | |
| 354 | break; | |
| 355 | } | |
| 356 | } | |
| 357 | asse rtTrue(eve nt != null ); | |
| 358 | ||
| 359 | asse rtThat(eve nt.getRecu rrenceFreq uency(), c ontainsStr ing(RECURR ING_FREQUE NCY)); | |
| 360 | asse rtTrue((ev ent.getNum berRemaini ng() == NU MBER_REMAI NING)); | |
| 361 | asse rtFalse((e vent.getEn dedOn() == null)); | |
| 362 | asse rtThat(eve nt.getEnde dByProvide rId(), con tainsStrin g(ENDED_BY _USER_ID)) ; | |
| 363 | asse rtThat(eve nt.getAsse ssmentName (), contai nsString(A SSESSMENT_ NAME_TEST_ 2)); | |
| 364 | ||
| 365 | resu lt = mockM vc.perform ( | |
| 366 | get(Even tResource. REQUEST_PR OVIDER_MAP PING_WITH_ PROVIDER, "EDIPI", p atientId) | |
| 367 | .contentTy pe(MediaTy pe.APPLICA TION_JSON) ) | |
| 368 | .andExpect (status(). isOk()).an dReturn(); | |
| 369 | resp onseBody = result.ge tResponse( ).getConte ntAsString (); | |
| 370 | asse rtTrue(res ponseBody != null); | |
| 371 | } | |
| 372 | ||
| 373 | /* * | |
| 374 | * Test virt ual delete on multip le provide r assignme nt fails. | |
| 375 | * | |
| 376 | * set logge d in user assigningA uthority t o SAME as assignment | |
| 377 | * assigning Authority and userId same as a ssignmentP roviderId => fail | |
| 378 | * | |
| 379 | * Verify MH PRO-5067 - expects v irtual del ete to NOT create as signment e vent | |
| 380 | * | |
| 381 | * @throws E xception | |
| 382 | * the exc eption | |
| 383 | * / | |
| 384 | @T est | |
| 385 | pu blic void testVirtua lDeleteMul tipleProvi derAssignm entFails_3 () throws Exception { | |
| 386 | ||
| 387 | crea teUser(ASS IGNMENT_PR OVIDER_ID, ASSIGNMEN T_PROVIDER _ASSIGN_AU TH); | |
| 388 | crea teTestData (ASSESSMEN T_NAME_TES T_3); | |
| 389 | ||
| 390 | MvcR esult resu lt = mockM vc | |
| 391 | .perform (delete(As signmentRe source.REQ UEST_PROVI DER_ASSIGH MENT_ID_MA PPING, | |
| 392 | "E DIPI",ASSI GNMENT_PRO VIDER_ID, assignment Id) | |
| 393 | .c ontentType (MediaType .APPLICATI ON_JSON)) | |
| 394 | .andExpe ct(status( ).isOk()). andReturn( ); | |
| 395 | ||
| 396 | Stri ng respons eBody = re sult.getRe sponse().g etContentA sString(); | |
| 397 | asse rtTrue(res ponseBody. equals("") ); | |
| 398 | ||
| 399 | List <Event> ev ents = eve ntReposito ry.findAll (); | |
| 400 | ||
| 401 | // e nsure even t was NOT created | |
| 402 | Even t event = null; | |
| 403 | for (Event ev : events) { | |
| 404 | if (AS SESSMENT_N AME_TEST_3 .equals(ev .getAssess mentName() )) { | |
| 405 | event = ev; | |
| 406 | break; | |
| 407 | } | |
| 408 | } | |
| 409 | ||
| 410 | asse rtTrue(eve nt == null ); | |
| 411 | } | |
| 412 | ||
| 413 | /* * | |
| 414 | * Test virt ual delete on multip le provide r assignme nt does no t create | |
| 415 | * multiple- provider e vent. | |
| 416 | * | |
| 417 | * set logge d in user assigningA uthority t o DIFFEREN T from ass ignment | |
| 418 | * assigning Authority and userId same as a ssignmentP roviderId => drops d own | |
| 419 | * to end OK | |
| 420 | * | |
| 421 | * Verify MH PRO-5067 - expects v irtual del ete to NOT create as signment e vent | |
| 422 | * | |
| 423 | * @throws E xception | |
| 424 | * the exc eption | |
| 425 | * / | |
| 426 | @T est | |
| 427 | pu blic void testVirtua lDeleteMul tipleProvi derAssignm entInvalid AssignAuth Fails_4() throws Exc eption { | |
| 428 | ||
| 429 | crea teUser(ASS IGNMENT_PR OVIDER_ID, "EDIPI"); | |
| 430 | crea teTestData (ASSESSMEN T_NAME_TES T_4); | |
| 431 | ||
| 432 | MvcR esult resu lt = mockM vc | |
| 433 | .perform (delete(As signmentRe source.REQ UEST_PROVI DER_ASSIGH MENT_ID_MA PPING, "ED IPI",ASSIG NMENT_PROV IDER_ID, a ssignmentI d) | |
| 434 | .c ontentType (MediaType .APPLICATI ON_JSON)) | |
| 435 | .andExpe ct(status( ).isOk()). andReturn( ); | |
| 436 | ||
| 437 | Stri ng respons eBody = re sult.getRe sponse().g etContentA sString(); | |
| 438 | // S ystem.out. println("r esponseBod y:["+respo nseBody+"] "); | |
| 439 | ||
| 440 | asse rtTrue(res ponseBody. equals("") ); | |
| 441 | } | |
| 442 | ||
| 443 | @T est | |
| 444 | pu blic void testProvid er_Duplica tes() thro ws Excepti on { | |
| 445 | crea teUser(END ED_BY_USER _ID, ASSIG NMENT_PROV IDER_ASSIG N_AUTH); | |
| 446 | crea teTestData (ASSESSMEN T_NAME_TES T_2); | |
| 447 | List <String> a ssignmentI ds = new A rrayList<> (); | |
| 448 | assi gnmentIds. add(assign mentId); | |
| 449 | Stri ng[] arr = assignmen tIds.toArr ay(new Str ing[assign mentIds.si ze()]); | |
| 450 | ||
| 451 | MvcR esult resu lt = mockM vc.perform (get(Assig nmentResou rce.REQUES T_PROVIDER _ASSIGHMEN T_DUPLICAT ES_ID_MAPP ING, | |
| 452 | "EDIPI", ENDED_BY_ USER_ID).p aram("assi gnment-id[ ]", arr) | |
| 453 | .content Type(Media Type.APPLI CATION_JSO N)).andExp ect(status ().isOk()) .andReturn (); | |
| 454 | ||
| 455 | resu lt = mockM vc | |
| 456 | .perform (delete(As signmentRe source.REQ UEST_PROVI DER_ASSIGH MENT_ID_MA PPING, | |
| 457 | "E DIPI", END ED_BY_USER _ID, assig nmentId) | |
| 458 | .c ontentType (MediaType .APPLICATI ON_JSON)) | |
| 459 | .andExpe ct(status( ).isOk()). andReturn( ); | |
| 460 | ||
| 461 | Stri ng respons eBody = re sult.getRe sponse().g etContentA sString(); | |
| 462 | asse rtTrue(res ponseBody. equals("") ); | |
| 463 | } | |
| 464 | ||
| 465 | pr ivate Assi gnment cre ateAssignm ent() { | |
| 466 | Assi gnment ass ignment = new Assign ment(); | |
| 467 | assi gnment.set PatientId( patientId) ; | |
| 468 | assi gnment.set PatientAss ignAuth("E DIPI"); | |
| 469 | assi gnment.set Recurrence Early(new Integer(4) ); | |
| 470 | assi gnment.set Recurrence Late(new I nteger(5)) ; | |
| 471 | assi gnment.set Completed( Boolean.FA LSE); | |
| 472 | ||
| 473 | assi gnment.set VirtualDel eted(false ); | |
| 474 | assi gnment.set ProviderAs signAuth(A SSIGNMENT_ PROVIDER_A SSIGN_AUTH ); | |
| 475 | assi gnment.set ProviderId (ASSIGNMEN T_PROVIDER _ID); | |
| 476 | ||
| 477 | assi gnment.set Recurrence Frequency( RECURRING_ FREQUENCY) ; | |
| 478 | assi gnment.set NumberRema ining(NUMB ER_REMAINI NG); | |
| 479 | assi gnment.set DocLastMod ifiedBy(DO C_LAST_MOD IFIED_BY); | |
| 480 | assi gnment.set DocUpdated Date(DOC_U PDATED_DAT E); | |
| 481 | assi gnment.set Assessment Name("GAD- 7"); | |
| 482 | ||
| 483 | retu rn assignm ent; | |
| 484 | } | |
| 485 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.