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\rpc\dao\impl | RpcSetAnswersAllDAOTest.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\rpc\dao\impl | RpcSetAnswersAllDAOTest.java | Fri Feb 1 19:27:43 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 314 |
| 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.rpc.dao .impl; | |
| 2 | ||
| 3 | import sta tic org.ju nit.Assert .assertNot Null; | |
| 4 | import sta tic org.ju nit.Assert .assertTru e; | |
| 5 | import sta tic org.mo ckito.Matc hers.any; | |
| 6 | import sta tic org.mo ckito.Mock ito.when; | |
| 7 | ||
| 8 | import jav a.util.Arr ayList; | |
| 9 | import jav a.util.Lis t; | |
| 10 | ||
| 11 | import jav ax.resourc e.cci.Conn ectionSpec ; | |
| 12 | ||
| 13 | import org .junit.Aft er; | |
| 14 | import org .junit.Bef ore; | |
| 15 | import org .junit.Tes t; | |
| 16 | import org .junit.run ner.RunWit h; | |
| 17 | import org .mockito.M ock; | |
| 18 | import org .mockito.r unners.Moc kitoJUnitR unner; | |
| 19 | import org .springfra mework.tes t.util.Ref lectionTes tUtils; | |
| 20 | ||
| 21 | import gov .va.med.ci ss.service .VistaCust omization; | |
| 22 | import gov .va.med.ci ss.service .log.Logge rListener; | |
| 23 | import gov .va.med.ci ss.service .vista.RPC Exception; | |
| 24 | import gov .va.med.ci ss.service .vista.Rpc ServiceUti l; | |
| 25 | import gov .va.med.ci ss.service .vista.Rpc ServiceUti lFactory; | |
| 26 | import gov .va.med.ci ss.service .vistalink .KaajeeSer vice; | |
| 27 | import gov .va.med.ci ss.service .vistalink .VistaLink Service; | |
| 28 | import gov .va.mobile .vamf.mhpr o.rpc.Answ er; | |
| 29 | import gov .va.mobile .vamf.mhpr o.service. IVistaLink AuditServi ce; | |
| 30 | ||
| 31 | /** | |
| 32 | * @author PII | |
| 33 | * | |
| 34 | * Unit te st RpcSetA nswersAll class. | |
| 35 | */ | |
| 36 | @RunWith(M ockitoJUni tRunner.cl ass) | |
| 37 | public cla ss RpcSetA nswersAllD AOTest { | |
| 38 | ||
| 39 | pr ivate RpcS etAnswersA llDAO rpcS etAnswersA llDAO; | |
| 40 | pr ivate RpcA llAnswersD AO rpcAllA nswersDAO; | |
| 41 | ||
| 42 | ||
| 43 | @M ock | |
| 44 | pr ivate RpcS erviceUtil Factory rp cServiceUt ilFactory; | |
| 45 | @M ock | |
| 46 | privat e IVistaLi nkAuditSer vice vista LinkAuditS ervice; | |
| 47 | ||
| 48 | @B efore | |
| 49 | pu blic void setUp() th rows Excep tion { | |
| 50 | // set u p so we ca n save | |
| 51 | rpcS etAnswersA llDAO = ne w RpcSetAn swersAllDA O(); | |
| 52 | Refl ectionTest Utils.setF ield(rpcSe tAnswersAl lDAO, "rpc ServiceUti lFactory", rpcServic eUtilFacto ry); | |
| 53 | Reflecti onTestUtil s.setField (rpcSetAns wersAllDAO , "vistaLi nkAuditSer vice", vis taLinkAudi tService); | |
| 54 | ||
| 55 | ||
| 56 | // set u p so we ca n get what we save | |
| 57 | rpcA llAnswersD AO = new R pcAllAnswe rsDAO(); | |
| 58 | Refl ectionTest Utils.setF ield(rpcAl lAnswersDA O, "rpcSer viceUtilFa ctory", rp cServiceUt ilFactory) ; | |
| 59 | Reflecti onTestUtil s.setField (rpcAllAns wersDAO, " vistaLinkA uditServic e", vistaL inkAuditSe rvice); | |
| 60 | } | |
| 61 | ||
| 62 | @A fter | |
| 63 | pu blic void tearDown() throws Ex ception { | |
| 64 | } | |
| 65 | ||
| 66 | @T est | |
| 67 | pu blic void testRpcAll AnswersDAO () throws Exception { | |
| 68 | Mock RpcService Util mockU til = new MockRpcSer viceUtil(n ull,null,n ull); | |
| 69 | when (rpcServic eUtilFacto ry.getInst ance(any(O bject.clas s))).thenR eturn(mock Util); | |
| 70 | ||
| 71 | Stri ng divisio n = "442"; | |
| 72 | Stri ng adminis trationId = "1"; | |
| 73 | Stri ng duz = " 74"; | |
| 74 | List <Answer> a nswers = n ew ArrayLi st<Answer> (); | |
| 75 | ||
| 76 | Answ er answer = new Answ er(); | |
| 77 | Stri ng answerT ext = "tex t for ques tionid 18" ; | |
| 78 | answ er.setAnsw erText(ans werText ); | |
| 79 | Stri ng questio nId = "18" ; | |
| 80 | answ er.setQues tionId(que stionId ); | |
| 81 | Stri ng respons eType = "S TRING"; | |
| 82 | answ er.setResp onseType(r esponseTyp e); | |
| 83 | answ ers.add(an swer); | |
| 84 | ||
| 85 | answ er = new A nswer(); | |
| 86 | Stri ng mchoice Text = "te xt for que stionid 51 09"; | |
| 87 | answ er.setChoi ceText(mch oiceText ) ; | |
| 88 | ques tionId = " 5109"; | |
| 89 | answ er.setQues tionId(que stionId ); | |
| 90 | resp onseType = "MCHOICE" ; | |
| 91 | answ er.setResp onseType(r esponseTyp e); | |
| 92 | answ ers.add(an swer); | |
| 93 | ||
| 94 | // s ave the an swers | |
| 95 | rpcS etAnswersA llDAO.save AnswersAll (division, administr ationId, a nswers , d uz); | |
| 96 | asse rtNotNull( answers); | |
| 97 | ||
| 98 | // r etrieve li st of answ ers we jus t saved | |
| 99 | List <Answer> a nswersRetr ieved = rp cAllAnswer sDAO.retri eveAllAnsw ers(divisi on, "GAD-7 ", adminis trationId, duz); | |
| 100 | asse rtNotNull( answersRet rieved); | |
| 101 | asse rtTrue(ans wersRetrie ved.size() >= 1); | |
| 102 | //Sy stem.out.p rintln("an swersRetri eved:"+ans wersRetrie ved); | |
| 103 | ||
| 104 | // g et one of the answer s | |
| 105 | Answ er answerR etrieved = answers.g et(0); | |
| 106 | asse rtTrue(ans werRetriev ed.getQues tionId().e quals("18" )); | |
| 107 | asse rtTrue(ans werRetriev ed.getAnsw erText().e quals("tex t for ques tionid 18" )); | |
| 108 | asse rtTrue(ans werRetriev ed.getResp onseType() .equals("S TRING")); | |
| 109 | ||
| 110 | } | |
| 111 | cl ass MockRp cServiceUt il extends RpcServic eUtil { | |
| 112 | ||
| 113 | /** The Consta nt EOL. */ | |
| 114 | priv ate final static Str ing EOL = "\n"; | |
| 115 | ||
| 116 | /** The Consta nt data. * / | |
| 117 | priv ate final static Str ing data = | |
| 118 | "[DATA]" + EOL + | |
| 119 | "1^17^GA D-7^317050 4.11^Y" + EOL + | |
| 120 | "18^1;1^ text for q uestionid 18" + EOL + | |
| 121 | "5109^20 ^4" + EOL + | |
| 122 | "5109^20 ;1^respons e to 5109" ; | |
| 123 | ||
| 124 | /* ( non-Javado c) | |
| 125 | * @ see gov.va .med.ciss. service.vi sta.RpcSer viceUtil#r unRpc(java .lang.Stri ng, java.l ang.String , java.uti l.List, go v.va.med.c iss.servic e.VistaCus tomization []) | |
| 126 | */ | |
| 127 | @Ove rride | |
| 128 | publ ic String runRpc(Str ing arg0, String arg 1, List<Ob ject> arg2 , | |
| 129 | VistaCus tomization ... arg3) throws RPC Exception { | |
| 130 | // TOD O Auto-gen erated met hod stub | |
| 131 | String result = data; | |
| 132 | return result; | |
| 133 | } | |
| 134 | ||
| 135 | /* ( non-Javado c) | |
| 136 | * @ see gov.va .med.ciss. service.vi sta.RpcSer viceUtil#s etLoggerCa llback(gov .va.med.ci ss.service .log.Logge rListener) | |
| 137 | */ | |
| 138 | @Ove rride | |
| 139 | publ ic void se tLoggerCal lback(Logg erListener loggerCal lback) { | |
| 140 | // TOD O Auto-gen erated met hod stub | |
| 141 | super. setLoggerC allback(lo ggerCallba ck); | |
| 142 | } | |
| 143 | ||
| 144 | /** | |
| 145 | * I nstantiate s a new mo ck rpc ser vice util. | |
| 146 | * | |
| 147 | * @ param conn Spec the c onn spec | |
| 148 | * @ param kaaj eeService the kaajee service | |
| 149 | * @ param vist aLinkServi ce the vis ta link se rvice | |
| 150 | * @ param vist aLinkAudit Service th e vista lo g service | |
| 151 | */ | |
| 152 | publ ic MockRpc ServiceUti l(Connecti onSpec con nSpec, | |
| 153 | KaajeeSe rvice kaaj eeService, VistaLink Service vi staLinkSer vice) { | |
| 154 | super( connSpec, kaajeeServ ice, vista LinkServic e); | |
| 155 | // TOD O Auto-gen erated con structor s tub | |
| 156 | } | |
| 157 | } | |
| 158 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.