20. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/8/2017 1:33:39 PM Central 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.

20.1 Files compared

# Location File Last Modified
1 PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\test\java\gov\va\med\fee\controller VaFacilityControllerTest.java Fri Dec 8 17:51:36 2017 UTC
2 PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\test\java\gov\va\med\fee\controller VaFacilityControllerTest.java Fri Dec 8 18:30:08 2017 UTC

20.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 656
Changed 2 4
Inserted 0 0
Removed 0 0

20.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

20.4 Active regular expressions

No regular expressions were active.

20.5 Comparison detail

  1   package go v.va.med.f ee.control ler;
  2  
  3   import sta tic org.ha mcrest.Mat chers.is;
  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.delete;
  9   import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.get;
  10   import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.post;
  11   import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.put;
  12   import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tHandlers. print;
  13   import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. content;
  14   import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. jsonPath;
  15   import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status;
  16  
  17   import jav a.math.Big Decimal;
  18   import jav a.util.Arr ayList;
  19   import jav a.util.Lis t;
  20  
  21   import org .apache.lo gging.log4 j.LogManag er;
  22   import org .apache.lo gging.log4 j.Logger;
  23   import org .junit.Bef ore;
  24   import org .junit.Tes t;
  25   import org .junit.run ner.RunWit h;
  26   import org .mockito.I njectMocks ;
  27   import org .mockito.M ock;
  28   import org .mockito.M ockito;
  29   import org .mockito.M ockitoAnno tations;
  30   import org .mockito.r unners.Moc kitoJUnitR unner;
  31   import org .springfra mework.htt p.MediaTyp e;
  32   import org .springfra mework.tes t.web.serv let.MockMv c;
  33   import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders;
  34  
  35   import com .fasterxml .jackson.c ore.JsonPr ocessingEx ception;
  36   import com .fasterxml .jackson.d atabind.Ob jectMapper ;
  37   import com .fasterxml .jackson.d atabind.Ob jectWriter ;
  38   import com .fasterxml .jackson.d atabind.Se rializatio nFeature;
  39  
  40   import gov .va.med.fe e.filter.C ORSFilter;
  41   import gov .va.med.fe e.model.re quest.Cont actInfoReq uest;
  42   import gov .va.med.fe e.model.re quest.VaFa cilityRequ est;
  43   import gov .va.med.fe e.model.re quest.VaFa cilitySear chRequest;
  44   import gov .va.med.fe e.model.re quest.ZipC odeRequest ;
  45   import gov .va.med.fe e.model.re sponse.Gen ericRespon se;
  46   import gov .va.med.fe e.model.re sponse.VaF acilityRes ponse;
  47   import gov .va.med.fe e.model.re sponse.VaF acilityTyp eResponse;
  48   import gov .va.med.fe e.model.re sponse.VaF acilityVis nResponse;
  49   import gov .va.med.fe e.service. IVaFacilit yService;
  50  
  51   @RunWith(M ockitoJUni tRunner.cl ass)
  52   public cla ss VaFacil ityControl lerTest {
  53           pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(VaFa cilityCont rollerTest .class);
  54           
  55           pr ivate Mock Mvc mockMv c;
  56           
  57           @I njectMocks
  58           pr ivate VaFa cilityCont roller vaF acilityCon troller;
  59           
  60           @M ock
  61           IV aFacilityS ervice iva FacilitySe rvice;
  62           
  63           @B efore
  64           pu blic void  init() thr ows Except ion {
  65                    logg er.debug(" init");
  66                    Mock itoAnnotat ions.initM ocks(this) ;
  67                    mock Mvc = Mock MvcBuilder s.standalo neSetup(va FacilityCo ntroller). addFilter( new CORSFi lter()).bu ild();
  68           }
  69           
  70           @T est
  71           pu blic void  test_getAl lVisn() th rows Excep tion {
  72                    VaFa cilityVisn Response r esponse =  new VaFaci lityVisnRe sponse();
  73                    List <VaFacilit yVisnRespo nse> res =  new Array List<VaFac ilityVisnR esponse>() ;
  74                    
  75                    resp onse.setDe scription( "test desc ription");
  76                    resp onse.setVi snIdCd(123 4L);
  77                    res. add(respon se);
  78                    
  79  
  80                    when (ivaFacili tyService. getAllVisn s()).thenR eturn(res) ;
  81                    
  82                    mock Mvc.perfor m(get("/ap i/v1/VaFac ility/stat ion/visn") ).andDo(pr int()).and Expect(sta tus().isOk ())
  83                    .and Expect(con tent().con tentType(M ediaType.A PPLICATION _JSON_UTF8 _VALUE))
  84                    .and Expect(jso nPath("$.[ 0].descrip tion", is( "test desc ription")) )
  85                    .and Expect(jso nPath("$.[ 0].visnIdC d", is(123 4)));
  86                    
  87                    veri fy(ivaFaci lityServic e, times(1 )).getAllV isns();
  88                    veri fyNoMoreIn teractions (ivaFacili tyService) ;            
  89           }
  90           
  91           @T est
  92           pu blic void  test_getAl lFacilityT ype() thro ws Excepti on {
  93                    VaFa cilityType Response r esponse =  new VaFaci lityTypeRe sponse();
  94                    List <VaFacilit yTypeRespo nse> res =  new Array List<VaFac ilityTypeR esponse>() ;
  95                    
  96                    resp onse.setDe scription( "test desc ription");
  97                    resp onse.setVa TypeCd("te st123");
  98                    res. add(respon se);
  99                    
  100  
  101                    when (ivaFacili tyService. getAllVaFa cilityType ()).thenRe turn(res);
  102                    
  103                    mock Mvc.perfor m(get("/ap i/v1/VaFac ility/stat ion/type") ).andDo(pr int()).and Expect(sta tus().isOk ())
  104                    .and Expect(con tent().con tentType(M ediaType.A PPLICATION _JSON_UTF8 _VALUE))
  105                    .and Expect(jso nPath("$.[ 0].descrip tion", is( "test desc ription")) )
  106                    .and Expect(jso nPath("$.[ 0].vaTypeC d", is("te st123")));
  107                    
  108                    veri fy(ivaFaci lityServic e, times(1 )).getAllV aFacilityT ype();
  109                    veri fyNoMoreIn teractions (ivaFacili tyService) ;   
  110           }
  111           
  112           @T est
  113           pu blic void  test_searc hStation()  throws Ex ception {
  114                    List <VaFacilit yResponse>  vaFacilit yResponseL ist = new  ArrayList< VaFacility Response>( );
  115                    Long  resultsCo unt = 1L;
  116  
  117                    BigD ecimal val ue = new B igDecimal( 30);
  118                    VaFa cilitySear chRequest  vaFacility Request =  new VaFaci litySearch Request(10 0, null, f alse, 1, n ull, "TOGU S",
  119                                      null, "A DMIN", nul l);
  120  
  121                    VaFa cilityResp onse vaFac ilityRespo nse = new  VaFacility Response(" 119", "ToG Us ME",
  122                                      "TOGUS V A MED/REGI ONAL OFFIC E CENTER",  "FAC", "7 ", true, v alue, null , "CPE_OWN ER",
  123                                      "06/01/2 017 00:00: 00 AM");
  124                    vaFa cilityResp onseList.a dd(vaFacil ityRespons e);
  125  
  126                    Gene ricRespons e visnSear chResponse  = new Gen ericRespon se(1, 100,  "station" , resultsC ount);
  127                    visn SearchResp onse.setRe sponse(vaF acilityRes ponseList) ;
  128  
  129                    when (ivaFacili tyService. getSearchV isn(vaFaci lityReques t)).thenRe turn(visnS earchRespo nse);
  130  
  131                    mock Mvc.perfor m(post("/a pi/v1/VaFa cility/sta tion/searc h").conten tType(Medi aType.APPL ICATION_JS ON)
  132                                      .content (getReques tJson(vaFa cilityRequ est))).and Do(print() );
  133  
  134                    veri fy(ivaFaci lityServic e, times(1 )).getSear chVisn(vaF acilityReq uest);
  135                    veri fyNoMoreIn teractions (ivaFacili tyService) ;
  136           }
  137           
  138           @T est
  139           pu blic void  test_addFa cility() t hrows Exce ption {
  140                    VaFa cilityRequ est reques t = new Va FacilityRe quest();
  141                    requ est.setAge dDefinitio n(1234L);
  142                    requ est.setApp UserName(" Test");
  143                    requ est.setPar entVaFacil ityCd("Tes t");
  144                    requ est.setVaF acilityCd( "test123") ;
  145                    requ est.setRer outingAllo wed(true);
  146                    requ est.setSho rtName("te st");
  147                    requ est.setVaF acilityCd( "test");
  148                    requ est.setVaF acilityNam e("test");
  149                    requ est.setVaT ypeCd("tes t");
  150                    requ est.setVis nIdCd(1234 L);
  151                    
  152                    Obje ctMapper m apper = ne w ObjectMa pper();
  153                mapper.c onfigure(S erializati onFeature. WRAP_ROOT_ VALUE, fal se);
  154                ObjectWr iter ow =  mapper.wri ter().with DefaultPre ttyPrinter ();
  155                    Stri ng request Json = ow. writeValue AsString(r equest);
  156                    
  157                    when (ivaFacili tyService. addVaFacil ity(Mockit o.anyObjec t())).then Return(1);
  158                    mock Mvc.perfor m(post("/a pi/v1/VaFa cility/sta tion").con tentType(M ediaType.A PPLICATION _JSON).con tent(reque stJson)).a ndDo(print ())
  159                    .and Expect(sta tus().is2x xSuccessfu l())
  160                    .and Expect(con tent().con tentType(M ediaType.A PPLICATION _JSON_UTF8 _VALUE))
  161                    .and Expect(jso nPath("$.r esult", is (1)));         
  162           }
  163           
  164           
  165           @T est
  166           pu blic void  test_modif yFacility( ) throws E xception {
  167                    VaFa cilityRequ est reques t = new Va FacilityRe quest();
  168                    requ est.setAge dDefinitio n(1234L);
  169                    requ est.setApp UserName(" Test");
  170                    requ est.setPar entVaFacil ityCd("Tes t");
  171                    requ est.setVaF acilityCd( "test123") ;
  172                    requ est.setRer outingAllo wed(true);
  173                    requ est.setSho rtName("te st");
  174                    requ est.setVaF acilityCd( "test");
  175                    requ est.setVaF acilityNam e("test");
  176                    requ est.setVaT ypeCd("tes t");
  177                    requ est.setVis nIdCd(1234 L);
  178                    bool ean value  = true;
  179                    
  180                    
  181                    Obje ctMapper m apper = ne w ObjectMa pper();
  182                mapper.c onfigure(S erializati onFeature. WRAP_ROOT_ VALUE, fal se);
  183                ObjectWr iter ow =  mapper.wri ter().with DefaultPre ttyPrinter ();
  184                    Stri ng request Json = ow. writeValue AsString(r equest);
  185                    
  186                    when (ivaFacili tyService. modifyStat ion(Mockit o.anyObjec t())).then Return(val ue);
  187                    mock Mvc.perfor m(put("/ap i/v1/VaFac ility/stat ion").cont entType(Me diaType.AP PLICATION_ JSON).cont ent(reques tJson)).an dDo(print( ))
  188                    .and Expect(sta tus().is2x xSuccessfu l())
  189                    .and Expect(con tent().con tentType(M ediaType.A PPLICATION _JSON_UTF8 _VALUE))
  190                    .and Expect(jso nPath("$.r esult", is (value)));     
  191           }
  192           
  193           @T est
  194           pu blic void  test_remov eStationCo de() throw s Exceptio n {
  195                    Stri ng station Name= "208 55";
  196                    
  197                    Bool ean respon se = Boole an.TRUE;
  198                    when (ivaFacili tyService. deleteStat ionInfo(st ationName) ).thenRetu rn(respons e);
  199                    
  200                    mock Mvc.perfor m(delete(" /api/v1/Va Facility/s tation/{st ationName} ", "20855" ).contentT ype(MediaT ype.APPLIC ATION_JSON ).content( getRequest Json(stati onName))). andDo(prin t());
  201                    
  202                    veri fy(ivaFaci lityServic e, times(1 )).deleteS tationInfo (stationNa me);
  203           }
  204           
  205           @T est
  206           pu blic void  test_addZi pCode() th rows Excep tion {
  207                    Stri ng appUser Name = "AB C";
  208                    Stri ng vaFacil ityCd = "1 0";
  209                    Stri ng zip_cod e= "20855" ;
  210                    Stri ng urban_i ndicator=  "10";
  211                    Stri ng fips_co unty_code=  "10";
  212                    Stri ng fips_st ate_code=  "10";
  213                    Bool ean active = Boolean. TRUE;
  214                    
  215                    ZipC odeRequest  request =  new ZipCo deRequest( appUserNam e, vaFacil ityCd, zip _code, urb an_indicat or,
  216                                      fips_cou nty_code,  fips_state _code, act ive);
  217                    
  218                    Bool ean respon se = Boole an.TRUE;
  219                    when (ivaFacili tyService. addZipCode (request)) .thenRetur n(response );
  220                    mock Mvc.perfor m(post("/a pi/v1/VaFa cility/sta tion/zipco de").conte ntType(Med iaType.APP LICATION_J SON)
  221                                      .content (getReques tJson(requ est))).and Do(print() );
  222                    veri fy(ivaFaci lityServic e, times(1 )).addZipC ode(reques t);
  223           }
  224           
  225           @T est
  226           pu blic void  test_editZ ipCode() t hrows Exce ption {
  227                    Stri ng appUser Name = "AB C"; //Not  null
  228                    Stri ng vaFacil ityCd = "1 0"; //Not  null, size  <= 12
  229                    Stri ng zip_cod e= "20855" ; //Not nu ll, size < = 10
  230                    Stri ng urban_i ndicator=  "100"; //s ize <= 10
  231                    Stri ng fips_co unty_code=  "100"; // size <= 3
  232                    Stri ng fips_st ate_code=  "50"; //si ze <= 2
  233                    Bool ean active = Boolean. TRUE;
  234                    
  235                    ZipC odeRequest  request =  new ZipCo deRequest( appUserNam e, vaFacil ityCd, zip _code, urb an_indicat or,
  236                                      fips_cou nty_code,  fips_state _code, act ive);
  237                    
  238                    Bool ean respon se = Boole an.TRUE;
  239                    when (ivaFacili tyService. editZipCod e(request) ).thenRetu rn(respons e);
  240                    
  241                    mock Mvc.perfor m(put("/ap i/v1/VaFac ility/stat ion/zipcod e").conten tType(Medi aType.APPL ICATION_JS ON)
  242                                      .content (getReques tJson(requ est))).and Do(print() );
  243                    veri fy(ivaFaci lityServic e, times(1 )).editZip Code(reque st);
  244           }
  245           
  246           @T est
  247           pu blic void  test_remov eZipCode()  throws Ex ception {
  248                    Stri ng zip_cod e= "20855" ;
  249                    Stri ng appUser Name = "AB C";
  250                    Stri ng vaFacil ityCd = "1 0";
  251                    
  252                    ZipC odeRequest  request =  new ZipCo deRequest( );
  253                    requ est.setZip _code(zip_ code);
  254                    requ est.setApp UserName(a ppUserName );
  255                    requ est.setVaF acilityCd( vaFacility Cd);
  256                    
  257                    Bool ean respon se = Boole an.TRUE;
  258                    when (ivaFacili tyService. removeZipC ode(reques t)).thenRe turn(respo nse);
  259                    
  260                    mock Mvc.perfor m(delete(" /api/v1/Va Facility/s tation/zip code").con tentType(M ediaType.A PPLICATION _JSON)
  261                                      .content (getReques tJson(requ est))).and Do(print() );
  262                    
  263                    veri fy(ivaFaci lityServic e, times(1 )).removeZ ipCode(req uest);
  264           }
  265           
  266           @T est
  267           pu blic void  test_addCo ntactInfo( ) throws E xception {
  268                    Stri ng appUser Name = "AB C";
  269                    Stri ng vaFacil ityCd = "1 23";
  270                                              
  271                    Cont actInfoReq uest reque st = new C ontactInfo Request();
  272                    requ est.setApp UserName(a ppUserName );
  273                    requ est.setVaF acilityCd( vaFacility Cd);
  274                    requ est.setAdd ress1("1 O racle Dr." );
  275                    requ est.setCit y("Palo Al to");
  276                    requ est.setCon tactName(" Mr. ABC");
  277                    requ est.setCon tactType(" Admin");
  278                     request.se tEmail(" PII         ");
  279                    requ est.setZip ("99988");
  280                    requ est.setPho ne("123456 7890");
  281           
  282                    Bool ean respon se = Boole an.TRUE;
  283                    when (ivaFacili tyService. postContac tInfo(requ est)).then Return(res ponse);
  284                    
  285                    mock Mvc.perfor m(post("/a pi/v1/VaFa cility/sta tion/conta ctInfo").c ontentType (MediaType .APPLICATI ON_JSON)
  286                                      .content (getReques tJson(requ est))).and Do(print() );
  287                    
  288                    veri fy(ivaFaci lityServic e, times(1 )).postCon tactInfo(r equest);
  289           }
  290           
  291           @T est
  292           pu blic void  test_modif yContactIn fo() throw s Exceptio n {
  293                    Stri ng appUser Name = "AB C";
  294                    Stri ng vaFacil ityCd = "1 23";
  295                                              
  296                    Cont actInfoReq uest reque st = new C ontactInfo Request();
  297                    requ est.setApp UserName(a ppUserName );
  298                    requ est.setVaF acilityCd( vaFacility Cd);
  299                    requ est.setAdd ress1("1 O racle Dr." );
  300                    requ est.setCit y("Palo Al to");
  301                    requ est.setCon tactName(" Mr. ABC");
  302                    requ est.setCon tactType(" Admin");
  303                     request.se tEmail(" PII         ");
  304                    requ est.setZip ("99988");
  305                    requ est.setPho ne("123456 7890");
  306           
  307                    Bool ean respon se = Boole an.TRUE;
  308                    when (ivaFacili tyService. postContac tInfo(requ est)).then Return(res ponse);
  309                    
  310                    mock Mvc.perfor m(post("/a pi/v1/VaFa cility/sta tion/conta ctInfo").c ontentType (MediaType .APPLICATI ON_JSON)
  311                                      .content (getReques tJson(requ est))).and Do(print() );
  312                    
  313                    veri fy(ivaFaci lityServic e, times(1 )).postCon tactInfo(r equest);
  314           }
  315           pr ivate Stri ng getRequ estJson(Ob ject reque st) {
  316                    Stri ng request Json = nul l;
  317                    try  {
  318                             Object Mapper map per = new  ObjectMapp er();
  319                         mapper.con figure(Ser ialization Feature.WR AP_ROOT_VA LUE, false );
  320                         ObjectWrit er ow = ma pper.write r().withDe faultPrett yPrinter() ;
  321                             reques tJson = ow .writeValu eAsString( request);
  322                             //Syst em.out.pri ntln("requ estJson -  " + reques tJson);
  323                    } ca tch (JsonP rocessingE xception e ) {
  324                             logger .error("ge tRequestJs on JsonPro cessingExc eption --  ");
  325                             e.prin tStackTrac e();
  326                    
  327                    }                 
  328                    retu rn request Json;
  329           }
  330   }