277. EPMO Open Source Coordination Office Redaction File Detail Report

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.

277.1 Files compared

# Location File Last Modified
1 MHPRO_v1.x.zip\mhpro-resources-master@a26412b610c.zip\ws\src\test\java\gov\va\mobile\vamf\mhpro\resource EventControllerSeverityAndScoreTest.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 EventControllerSeverityAndScoreTest.java Fri Feb 1 19:27:42 2019 UTC

277.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 698
Changed 1 2
Inserted 0 0
Removed 0 0

277.3 Comparison options

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

277.4 Active regular expressions

No regular expressions were active.

277.5 Comparison detail

  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 .assertTru e;
  6   import sta tic org.mo ckito.Mock ito.when;
  7   import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.delete;
  8   import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.get;
  9   import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status;
  10  
  11   import jav a.util.Arr ayList;
  12   import jav a.util.Lis t;
  13  
  14   import org .joda.time .DateTime;
  15   import org .junit.Aft er;
  16   import org .junit.Bef ore;
  17   import org .junit.Tes t;
  18   import org .junit.run ner.RunWit h;
  19   import org .mockito.M ock;
  20   import org .mockito.M ockitoAnno tations;
  21   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  22   import org .springfra mework.htt p.MediaTyp e;
  23   import org .springfra mework.tes t.context. ContextCon figuration ;
  24   import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ;
  25   import org .springfra mework.tes t.context. web.WebApp Configurat ion;
  26   import org .springfra mework.tes t.util.Ref lectionTes tUtils;
  27   import org .springfra mework.tes t.web.serv let.MvcRes ult;
  28  
  29   import com .agilex.he althcare.m obilehealt hplatform. domain.Mhp User;
  30   import com .agilex.he althcare.m obilehealt hplatform. domain.Pat ientIdenti fier;
  31  
  32   import gov .va.mobile .vamf.mhpr o.datalaye r.Assessme ntReposito ry;
  33   import gov .va.mobile .vamf.mhpr o.datalaye r.Assignme ntReposito ry;
  34   import gov .va.mobile .vamf.mhpr o.datalaye r.EventRep ository;
  35   import gov .va.mobile .vamf.mhpr o.domain.A nswer;
  36   import gov .va.mobile .vamf.mhpr o.domain.A ssessment;
  37   import gov .va.mobile .vamf.mhpr o.domain.A ssignment;
  38   import gov .va.mobile .vamf.mhpr o.domain.E vent;
  39   import gov .va.mobile .vamf.mhpr o.domain.F ormat;
  40   import gov .va.mobile .vamf.mhpr o.domain.R esponse;
  41   import gov .va.mobile .vamf.mhpr o.domain.R esponseSec tion;
  42   import gov .va.mobile .vamf.mhpr o.domain.S core;
  43   import gov .va.mobile .vamf.mhpr o.domain.S coreMetaDa ta;
  44   import gov .va.mobile .vamf.mhpr o.service. ICurrentUs erService;
  45  
  46   /**
  47    * The Cla ss EventCo ntrollerTe st.
  48    * 
  49    * @author   PII
  50    * 
  51    */
  52   @RunWith(S pringJUnit 4ClassRunn er.class)
  53   @WebAppCon figuration
  54   @ContextCo nfiguratio n({ "class path:appli cationCont ext.xml",  "classpath :dispatche r-servlet. xml",
  55                    "cla sspath:mon goContext. xml" })
  56  
  57   public cla ss EventCo ntrollerSe verityAndS coreTest e xtends Abs tractMVCCo ntrollerTe ster {
  58  
  59           pr ivate stat ic String  assessment Id;
  60           pr ivate stat ic List<St ring> asse ssmentIds  = new Arra yList<Stri ng>();
  61           pr ivate stat ic List<St ring> assi gnmentIds  = new Arra yList<Stri ng>();
  62  
  63           pr ivate Asse ssment pro viderAsses sment;
  64  
  65           /* * The cont roller. */
  66           @A utowired
  67           pr ivate Even tResource  controller ;
  68  
  69           /* * The even t reposito ry. */
  70           @A utowired
  71           pr ivate Even tRepositor y eventRep ository;
  72  
  73           @A utowired
  74           pr ivate Asse ssmentRepo sitory ass essmentRep ository;
  75  
  76           @A utowired
  77           pr ivate Assi gnmentRepo sitory ass ignmentRep ository;
  78  
  79           /* * The user  service.  */
  80           @M ock
  81           pr ivate ICur rentUserSe rvice user Service;
  82  
  83           /* * The pati ent id. */
  84           pr ivate stat ic String  patientId  = "345346" ;
  85  
  86           /* * The even t id. */
  87           pr ivate stat ic String  eventId;
  88  
  89           /* * The user . */
  90           pr ivate MhpU ser user;
  91  
  92           pr ivate stat ic String  ASSESSMENT _NAME = "G AD-7";
  93           //  private s tatic Stri ng ASSESSM ENT_NAME =  "PCL-5";
  94           pr ivate stat ic String  PATIENT_AS SIGN_AUTH  = "EDIPI";
  95           pr ivate stat ic String  PROVIDER_A SSIGN_AUTH  = "dfn-00 0";
  96           pr ivate stat ic String  PROVIDER_I D = "34534 6";
  97  
  98           pr ivate stat ic int SCO RE = 17;
  99           pr ivate stat ic String  SEVERITY =  "Severe";
  100  
  101           /* *
  102            *  Sets the  up.
  103            *
  104            *  @throws E xception
  105            *               the exc eption
  106            * /
  107           @B efore
  108           pu blic void  setUp() th rows Excep tion {
  109                    Mock itoAnnotat ions.initM ocks(this) ;
  110  
  111                    // p artialTest ();
  112                    full Test();
  113           }
  114  
  115  
  116           pr ivate void  fullTest( ) {
  117                    Asse ssment ass essment =  new Assess ment();
  118                    asse ssment.set PatientId( patientId) ;
  119                    asse ssment.set PatientAss ignAuth(PA TIENT_ASSI GN_AUTH);
  120                    asse ssment.set Assessment Name(ASSES SMENT_NAME );
  121                    asse ssment.set ProviderId (patientId );
  122                    asse ssment.set Completed( Boolean.TR UE);
  123                    Date Time today  = new Dat eTime();
  124                    Date Time start Date = tod ay.minusDa ys(4);
  125                    Date Time endDa te = today .plusDays( 5);
  126                    asse ssment.set StartDate( startDate) ;
  127                    asse ssment.set EndDate(en dDate);
  128  
  129                    asse ssment.set Score(SCOR E);
  130                    asse ssment.set Severity(S EVERITY);
  131  
  132                    this .providerA ssessment  = assessme nt;
  133  
  134                    // c ompleted t est
  135                    Assi gnment ass ignment =  new Assign ment();
  136                    assi gnment.set PatientId( patientId) ;
  137                    assi gnment.set PatientAss ignAuth(as sessment.g etPatientA ssignAuth( ));
  138                    assi gnment.set Recurrence Early(new  Integer(4) );
  139                    assi gnment.set Recurrence Late(new I nteger(5)) ;
  140                    assi gnment.set Completed( Boolean.TR UE);
  141  
  142                    assi gnmentRepo sitory.sav e(assignme nt);
  143                    assi gnmentIds. add(assign ment.get_i d());
  144  
  145                    asse ssment.set _assignmen tId(assign ment.get_i d());
  146  
  147                    Resp onseSectio n response Section =  new Respon seSection( );
  148                    List <Answer> a nswers = n ew ArrayLi st<Answer> ();
  149                    resp onseSectio n.setAnswe rs(answers );
  150                    List <ResponseS ection> li stSections  = new Arr ayList<Res ponseSecti on>();
  151                    list Sections.a dd(respons eSection);
  152  
  153                    List <Score> sc ores = new  ArrayList <>();
  154                    scor es.add(new  Score("To tal", new  Integer(SC ORE).toStr ing()));
  155  
  156                    Resp onse respo nse = new  Response() ;
  157                    resp onse.setSe ctions(lis tSections) ;
  158                    resp onse.setDa teSubmitte d(DateTime .now());
  159                    resp onse.setSc ores(score s);
  160                    asse ssment.set Response(r esponse);
  161  
  162                    List <ScoreMeta Data> scor eMetaDataL ist = new  ArrayList< ScoreMetaD ata>();
  163                    Form at format  = new Form at();
  164                    asse ssment.set Format(for mat);
  165                    asse ssment.get Format().s etScoreMet aDataList( scoreMetaD ataList);
  166  
  167                    asse ssmentRepo sitory.sav e(assessme nt);
  168                    asse ssmentId =  assessmen t.get_id() ;
  169                    asse ssmentIds. add(assess ment.get_i d());
  170  
  171                    Even t event =  new Event( Event.COMP LETED, ass essment);
  172  
  173                    even t.setPatie ntAssignAu th(PATIENT _ASSIGN_AU TH);
  174                    even t.setProvi derAssignA uth(PROVID ER_ASSIGN_ AUTH);
  175                    even t.setProvi derId(PROV IDER_ID);
  176                    even t.set_asse ssmentId(a ssessmentI d);
  177                    even t.setEvent Type(Event .DUE);
  178                    even t.setPatie ntId(patie ntId);
  179                    even t.setPatie ntVirtualD eleted(fal se);
  180                    even t.setProvi derVirtual Deleted(fa lse);
  181  
  182                    even tRepositor y.save(eve nt);
  183                    even tId = even t.get_id() ;
  184  
  185                    Refl ectionTest Utils.setF ield(contr oller, "us erService" , userServ ice);
  186  
  187                    user  = new Mhp User();
  188                    Pati entIdentif ier identi fier = new  PatientId entifier() ;
  189                    iden tifier.set AssigningA uthority(P ROVIDER_AS SIGN_AUTH) ;
  190                    iden tifier.set UniqueId(P ROVIDER_ID );
  191                    Refl ectionTest Utils.setF ield(user,  "userIden tifier", i dentifier) ;
  192  
  193                    when (userServi ce.getUser ()).thenRe turn(user) ;
  194           }
  195  
  196           /* *
  197            *  Tear down .
  198            *
  199            *  @throws E xception
  200            *               the exc eption
  201            * /
  202           @A fter
  203           pu blic void  tearDown()  throws Ex ception {
  204                    Even t event =  eventRepos itory.find By_id(even tId);
  205                    if ( event != n ull)
  206                             eventR epository. delete(eve nt);
  207  
  208                    for  (int assig nId = 0; a ssignId <  assignment Ids.size() ; assignId ++) {
  209                             assign mentReposi tory.delet e(assignme ntIds.get( assignId)) ;
  210                    }
  211  
  212                    asse ssmentRepo sitory.del ete(assess mentId);
  213  
  214           }
  215  
  216           /* *
  217            *  Test get  patient ev ents.
  218            *
  219            *  @throws E xception
  220            *               the exc eption
  221            * /
  222           @T est
  223           pu blic void  testGetPat ientEvents () throws  Exception  {
  224  
  225                    MvcR esult resu lt = mockM vc.perform (get(Event Resource.R EQUEST_PAT IENT_MAPPI NG, PATIEN T_ASSIGN_A UTH, patie ntId)
  226                                      .content Type(Media Type.APPLI CATION_JSO N)).andExp ect(status ().isOk()) .andReturn ();
  227  
  228                    Stri ng respons eBody = re sult.getRe sponse().g etContentA sString();
  229                    Syst em.out.pri ntln("pati ent respon seBody\n"  + response Body);
  230  
  231                    asse rtThat(res ponseBody,  containsS tring(
  232                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringsWith EscapedDou bleQuote(" patientId" , "345346" )));
  233                    asse rtThat(res ponseBody,
  234                                      contains String(Tes tUtils.bui ldContains NullValueS tringWithE scapedDoub leQuote("s everity")) );
  235           }
  236  
  237           /* *
  238            *  Test get  patient ev ents.
  239            *
  240            *  @throws E xception
  241            *               the exc eption
  242            * /
  243           //  @Test
  244           //  not worki ng - finds  no record s
  245           pu blic void  testGetCom pletedPati entEvents( ) throws E xception {
  246                    Even t event =  eventRepos itory.find By_id(even tId);
  247                    even t.setEvent Type(Event .COMPLETED );
  248                    even t.setPatie ntAssignAu th(PATIENT _ASSIGN_AU TH);
  249                    even t.setPatie ntId(patie ntId);
  250                    // e vent.setEv entType(Ev ent.DUE);
  251                    even tRepositor y.save(eve nt);
  252  
  253                    MvcR esult resu lt = mockM vc.perform (get(Event Resource.R EQUEST_PAT IENT_MAPPI NG, PATIEN T_ASSIGN_A UTH, patie ntId)
  254                                      .content Type(Media Type.APPLI CATION_JSO N)).andExp ect(status ().isOk()) .andReturn ();
  255  
  256                    Stri ng respons eBody = re sult.getRe sponse().g etContentA sString();
  257                    Syst em.out.pri ntln("pati ent respon seBody\n"  + response Body);
  258  
  259                    asse rtThat(res ponseBody,  containsS tring(
  260                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringsWith EscapedDou bleQuote(" patientId" , "345346" )));
  261  
  262                    asse rtThat(res ponseBody,  containsS tring(
  263                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringWithE scapedDoub leQuote("s core", SCO RE)));
  264  
  265                    asse rtThat(res ponseBody,  containsS tring(
  266                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringsWith EscapedDou bleQuote(" severity",  SEVERITY) ));
  267           }
  268  
  269           /* *
  270            *  Test clea r patient  event.
  271            *
  272            *  @throws E xception
  273            *               the exc eption
  274            * /
  275           //  @Test
  276           pu blic void  testClearP atientEven t() throws  Exception  {
  277                    mock Mvc.perfor m(delete(E ventResour ce.REQUEST _PATIENT_E VENT_ID_MA PPING, PAT IENT_ASSIG N_AUTH, pa tientId, e ventId)
  278                                      .content Type(Media Type.APPLI CATION_JSO N)).andExp ect(status ().isOk()) .andReturn ();
  279                    Even t event =  eventRepos itory.find By_id(even tId);
  280                    asse rtTrue(eve nt.getPati entVirtual Deleted()) ;
  281           }
  282  
  283           /* *
  284            *  Test get  provider e vents.
  285            *
  286            *  @throws E xception
  287            *               the exc eption
  288            * /
  289           //  @Test
  290           //  nothing r eturned
  291           pu blic void  testGetPro viderEvent s() throws  Exception  {
  292                    Even t event =  eventRepos itory.find By_id(even tId);
  293                    even t.setEvent Type(Event .DUE);
  294                    even tRepositor y.save(eve nt);
  295  
  296                    MvcR esult resu lt = mockM vc
  297                                      .perform (get(Event Resource.R EQUEST_PRO VIDER_MAPP ING_WITH_P ROVIDER).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                    Syst em.out.pri ntln("prov ider event s response Body\n" +  responseBo dy);
  302  
  303                    asse rtThat(res ponseBody,  containsS tring(
  304                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringsWith EscapedDou bleQuote(" providerId ", "345346 ")));
  305                    asse rtThat(res ponseBody,  containsS tring(
  306                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringWithE scapedDoub leQuote("s core", SCO RE)));
  307                    asse rtThat(res ponseBody,  containsS tring(
  308                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringsWith EscapedDou bleQuote(" severity",  SEVERITY) ));
  309           }
  310  
  311           /* *
  312            *  Test get  provider e vents.
  313            *
  314            *  @throws E xception
  315            *               the exc eption
  316            * /
  317           @T est
  318           pu blic void  testGetCom pletedProv iderEvents () throws  Exception  {
  319                    Even t event =  eventRepos itory.find By_id(even tId);
  320                    even t.setEvent Type(Event .COMPLETED );
  321                    even tRepositor y.save(eve nt);
  322  
  323                    MvcR esult resu lt = mockM vc
  324                                      .perform (get(Event Resource.R EQUEST_PRO VIDER_MAPP ING_WITH_P ROVIDER).c ontentType (MediaType .APPLICATI ON_JSON))
  325                                      .andExpe ct(status( ).isOk()). andReturn( );
  326  
  327                    Stri ng respons eBody = re sult.getRe sponse().g etContentA sString();
  328                    Syst em.out.pri ntln("prov ider event s response Body\n" +  responseBo dy);
  329  
  330                    asse rtThat(res ponseBody,  containsS tring(
  331                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringsWith EscapedDou bleQuote(" providerId ", "345346 ")));
  332                    asse rtThat(res ponseBody,  containsS tring(
  333                                      TestUtil s.buildCon tainsStrin gColonSpac edAndWrapS tringsWith EscapedDou bleQuote(" severity",  SEVERITY) ));
  334           }
  335  
  336           /* *
  337            *  Test clea r provider  event.
  338            *
  339            *  @throws E xception
  340            *               the exc eption
  341            * /
  342           //  @Test
  343           pu blic void  testClearP roviderEve nt() throw s Exceptio n {
  344                    mock Mvc.perfor m(delete(E ventResour ce.REQUEST _PROVIDER_ EVENT_ID_M APPING, ev entId)
  345                                      .content Type(Media Type.APPLI CATION_JSO N)).andExp ect(status ().isOk()) .andReturn ();
  346                    Even t event =  eventRepos itory.find By_id(even tId);
  347                    asse rtTrue(eve nt.getProv iderVirtua lDeleted() );
  348           }
  349  
  350   }