Produced by Araxis Merge on 4/27/2018 2:59:15 PM Central Daylight 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 | v2.0_Sprint_15_Build_5.zip\v2.0_Sprint_15_Build_5\Unredacted\ARS_Backend\ars_app\src\test\java\gov\va\med\ars\controller | UserAdminControllerTest.java | Tue Apr 24 14:49:58 2018 UTC |
| 2 | v2.0_Sprint_15_Build_5..zip\v2.0_Sprint_15_Build_5\Unredacted\ARS_Backend\ars_app\src\test\java\gov\va\med\ars\controller | UserAdminControllerTest.java | Thu Apr 26 16:38:49 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 162 |
| Changed | 2 | 4 |
| 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.med.a rs.control ler; | |
| 2 | ||
| 3 | import sta tic org.mo ckito.Matc hers.any; | |
| 4 | import sta tic org.mo ckito.Mock ito.times; | |
| 5 | import sta tic org.mo ckito.Mock ito.verify ; | |
| 6 | import sta tic org.mo ckito.Mock ito.verify NoMoreInte ractions; | |
| 7 | import sta tic org.mo ckito.Mock ito.when; | |
| 8 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.post; | |
| 9 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tHandlers. print; | |
| 10 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status; | |
| 11 | ||
| 12 | import org .junit.Bef ore; | |
| 13 | import org .junit.Tes t; | |
| 14 | import org .junit.run ner.RunWit h; | |
| 15 | import org .mockito.I njectMocks ; | |
| 16 | import org .mockito.M atchers; | |
| 17 | import org .mockito.M ock; | |
| 18 | import org .mockito.M ockitoAnno tations; | |
| 19 | import org .springfra mework.htt p.MediaTyp e; | |
| 20 | import org .springfra mework.tes t.context. ContextCon figuration ; | |
| 21 | import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ; | |
| 22 | import org .springfra mework.tes t.context. web.WebApp Configurat ion; | |
| 23 | import org .springfra mework.tes t.web.serv let.MockMv c; | |
| 24 | import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders; | |
| 25 | ||
| 26 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
| 27 | import com .fasterxml .jackson.d atabind.Ob jectWriter ; | |
| 28 | import com .fasterxml .jackson.d atabind.Se rializatio nFeature; | |
| 29 | ||
| 30 | import gov .va.med.ar s.configur ation.AppC onfig; | |
| 31 | import gov .va.med.ar s.configur ation.spri ng.SpringM vcConfig; | |
| 32 | import gov .va.med.ar s.filter.C ORSFilter; | |
| 33 | import gov .va.med.ar s.model.re quest.User SearchRequ est; | |
| 34 | import gov .va.med.ar s.service. IUserAdmin Service; | |
| 35 | import jav afx.util.P air; | |
| 36 | ||
| 37 | @WebAppCon figuration | |
| 38 | @RunWith(S pringJUnit 4ClassRunn er.class) | |
| 39 | @ContextCo nfiguratio n(classes = { AppCon fig.class, SpringMvc Config.cla ss }) | |
| 40 | public cla ss UserAdm inControll erTest { | |
| 41 | ||
| 42 | pr ivate Mock Mvc mockMv c; | |
| 43 | ||
| 44 | @M ock | |
| 45 | pr ivate IUse rAdminServ ice adminS ervice; | |
| 46 | ||
| 47 | @I njectMocks | |
| 48 | pr ivate User AdminContr oller admi nControlle r; | |
| 49 | ||
| 50 | @B efore | |
| 51 | pu blic void init() thr ows Except ion { | |
| 52 | Mock itoAnnotat ions.initM ocks(this) ; | |
| 53 | mock Mvc = Mock MvcBuilder s.standalo neSetup(ad minControl ler).addFi lters(new CORSFilter ()).build( ); | |
| 54 | } | |
| 55 | ||
| 56 | @S uppressWar nings("res triction") | |
| 57 | @T est | |
| 58 | pu blic void testCreate User() thr ows Except ion { | |
| 59 | ||
| 60 | User SearchRequ est reques t = new Us erSearchRe quest(); | |
| 61 | requ est.setAdm in("y"); | |
| 62 | requ est.setCre atedBy("AR S_ADMIN"); | |
| 63 | request.se tDomain(" DN S "); | |
| 64 | requ est.setSta tus("Y"); | |
| 65 | requ est.setEdi t("Y"); | |
| 66 | requ est.setExp ort("Y"); | |
| 67 | request.se tUserName( " PII "); | |
| 68 | ||
| 69 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
| 70 | mapp er.configu re(Seriali zationFeat ure.FAIL_O N_EMPTY_BE ANS, false ); | |
| 71 | mapp er.configu re(Seriali zationFeat ure.WRAP_R OOT_VALUE, false); | |
| 72 | Obje ctWriter o w = mapper .writer(). withDefaul tPrettyPri nter(); | |
| 73 | Stri ng request BodyJson = ow.writeV alueAsStri ng(request ); | |
| 74 | ||
| 75 | when (adminServ ice.create User(any(U serSearchR equest.cla ss))).then Return(new Pair <Str ing,Boolea n>("User w as success fully crea ted.",true )); | |
| 76 | ||
| 77 | mock Mvc.perfor m(post("/a pi/v1/admi n/createUs er").conte ntType(Med iaType.APP LICATION_J SON) | |
| 78 | .content (requestBo dyJson)).a ndDo(print ()).andExp ect(status ().isCreat ed()); | |
| 79 | ||
| 80 | veri fy(adminSe rvice, tim es(1)).cre ateUser(Ma tchers.ref Eq(request )); | |
| 81 | veri fyNoMoreIn teractions (adminServ ice); | |
| 82 | } | |
| 83 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.