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

285.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\validators EventValidatorTest.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\validators EventValidatorTest.java Fri Feb 1 19:27:43 2019 UTC

285.2 Comparison summary

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

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

285.4 Active regular expressions

No regular expressions were active.

285.5 Comparison detail

  1   package go v.va.mobil e.vamf.mhp ro.validat ors;
  2  
  3   import sta tic org.ha mcrest.Mat chers.null Value;
  4   import sta tic org.ju nit.Assert .assertTha t;
  5   import sta tic org.mo ckito.Matc hers.any;
  6   import sta tic org.mo ckito.Mock ito.when;
  7   import gov .va.mobile .vamf.mhpr o.datalaye r.WhiteLis tRepositor y;
  8   import gov .va.mobile .vamf.mhpr o.domain.E vent;
  9   import gov .va.mobile .vamf.mhpr o.domain.W hitelist;
  10   import gov .va.mobile .vamf.mhpr o.validato rs.impl.Ev entValidat or;
  11  
  12   import jav a.util.Arr ayList;
  13   import jav a.util.Has hMap;
  14   import jav a.util.Lis t;
  15   import jav a.util.Map ;
  16   import jav a.util.Set ;
  17  
  18   import jav ax.validat ion.Constr aintViolat ion;
  19   import jav ax.validat ion.Valida tion;
  20   import jav ax.validat ion.Valida torFactory ;
  21  
  22   import org .junit.Bef ore;
  23   import org .junit.Bef oreClass;
  24   import org .junit.Tes t;
  25   import org .junit.run ner.RunWit h;
  26   import org .mockito.M ock;
  27   import org .mockito.r unners.Moc kitoJUnitR unner;
  28   import org .springfra mework.val idation.Bi ndingResul t;
  29   import org .springfra mework.val idation.Da taBinder;
  30   import org .springfra mework.val idation.Fi eldError;
  31  
  32   /**
  33    * @author   PII
  34    *
  35    * Unit te st for Eve ntValidato r class.
  36    */
  37   @RunWith(M ockitoJUni tRunner.cl ass)
  38   public cla ss EventVa lidatorTes t {
  39  
  40           pr ivate stat ic javax.v alidation. Validator  annotation Validator;
  41           
  42           @B eforeClass
  43           pu blic stati c void cla ssSetup()  {
  44                    Vali datorFacto ry factory  = Validat ion.buildD efaultVali datorFacto ry();
  45                    anno tationVali dator = fa ctory.getV alidator() ;
  46           }
  47           
  48           pr ivate Even t event;     
  49           pr ivate Data Binder bin der;
  50           
  51           @M ock
  52           pr ivate Whit eListRepos itory whit eListRepos itory;
  53           
  54           @B efore
  55           pu blic void  setup() {
  56                    even t = new Ev ent();
  57                    even t.setAsses smentName( "INVALID A SSESSMENT  NAME");
  58                    bind er = new D ataBinder( event);
  59                    
  60                    Even tValidator  eventVali dator = ne w EventVal idator();
  61                    bind er.addVali dators(eve ntValidato r);            
  62           }
  63           
  64  
  65           /* *
  66            *  TODO - fi x test
  67            * /
  68           @T est
  69           pu blic void  shouldVali dateAssess mentName()  {
  70                    when (whiteList Repository .findByAss essmentNam e(any(Stri ng.class)) ).thenRetu rn(null);
  71                    
  72                    bind er.validat e();
  73                    Bind ingResult  result = b inder.getB indingResu lt();
  74                    
  75                    // T ODO - fix  test
  76           }
  77           
  78           
  79           /* *
  80            *  TODO - fi x test
  81            * /
  82           @T est
  83           pu blic void  shouldVali dateNumber Occurrence sVsFrequen cy() {
  84                    Whit elist item  = new Whi telist();
  85                    item .setAssess mentName(" PHQ-9");
  86                    List <Whitelist > items =  new ArrayL ist<>();
  87                    item s.add(item );
  88                    when (whiteList Repository .findByAss essmentNam e(any(Stri ng.class)) ).thenRetu rn(item);
  89                    
  90                    bind er.validat e();
  91                    Bind ingResult  result = b inder.getB indingResu lt();
  92                    // T ODO - fix  test
  93                    //as sertThat(r esult.getE rrorCount( ), equalTo (1));
  94           }
  95           
  96           
  97           @T est
  98           pu blic void  shouldAllo wStartDate AtBeginnin gOfToday()  {
  99                    bind er.validat e();
  100                    Bind ingResult  result = b inder.getB indingResu lt();
  101                    Fiel dError err or = resul t.getField Error("sta rtDate");
  102                    asse rtThat(err or, nullVa lue());
  103           }
  104           
  105           pr ivate Map< String, Li st<Constra intViolati on<Event>> > toMap(Se t<Constrai ntViolatio n<Event>>  violations ) {
  106                    Map< String, Li st<Constra intViolati on<Event>> > result =
  107                                      new Hash Map<>();
  108                    
  109                    for  (Constrain tViolation <Event> vi olation :  violations ) {
  110                             String  property  = violatio n.getPrope rtyPath(). toString() ;
  111                             List<C onstraintV iolation<E vent>> vio lationList  = result. get(proper ty);
  112                             
  113                             if(vio lationList  == null)  {
  114                                      violatio nList = ne w ArrayLis t<>();
  115                             }
  116                             
  117                             violat ionList.ad d(violatio n);
  118                             
  119                             result .put(viola tion.getPr opertyPath ().toStrin g(),violat ionList);
  120                    }
  121                    
  122                    retu rn result;
  123           }
  124  
  125   }