_INDEX = 1;
    private static final long PERSON_COUNT = 4;
    private static final Long PERSON_ID = Long.valueOf(5);
    
    private static final String FIRST_NAME = "Foo";
    private static final String FIRST_NAME_UPDATED = "FooUpdated";
    private static final String LAST_NAME = "Bar";
    private static final String LAST_NAME_UPDATED = "BarUpdated";

    private static final String SEARCH_TERM = "foo";
    
    private PersonController controller;
    
    private PersonService personServiceMock;

    @Override
    public void setUpTest() {
        controller = new PersonController();

        controller.setMessageSource(getMessageSourceMock());

        personServiceMock = mock(PersonService.class);
        controller.setPersonService(personServiceMock);
    }

    @Test
    public void count() {
        SearchDTO searchCriteria = createSearchDTO();
        when(personServiceMock.count(searchCriteria.getSearchTerm())).thenReturn(PERSON_COUNT);

        long personCount = controller.count(searchCriteria);

        verify(personServiceMock, times(1)).count(searchCriteria.getSearchTerm());
        verifyNoMoreInteractions(personServiceMock);

        assertEquals(PERSON_COUNT, personCount);
    }

    @Test
    public void delete() throws PersonNotFoundException {
        Person deleted = PersonTestUtil.createModelObject(PERSON_ID, FIRST_NAME, LAST_NAME);
        when(personServiceMock.delete(PERSON_ID)).thenReturn(deleted);
        
        initMessageSourceForFeedbackMessage(PersonController.FEEDBACK_MESSAGE_KEY_PERSON_DELETED);
        
        RedirectAttributes attributes = new RedirectAttributesModelMap();
        String view = controller.delete(PERSON_ID, attributes);
        
        verify(personServiceMock, times(1)).delete(PERSON_ID);
        verifyNoMoreInteractions(personServiceMock);
        assertFeedbackMessage(attributes, PersonController.FEEDBACK_MESSAGE_KEY_PERSON_DELETED);
        
        String expectedView = createExpectedRedirectViewPath(PersonController.REQUEST_
_ INDEX = 1; 
     private static final retentive PERSON_COUNT = 4; 
     individual static final Long PERSON_ID = Long.valueOf(5); 
    
     private electrostatic final String FIRST_NAME = " Foo "; 
     private electrostatic concluding String FIRST_NAME_UPDATED = " FooUpdated "; 
     private static final String LAST_NAME = " Bar "; 
     secret static final String LAST_NAME_UPDATED = " BarUpdated "; 

     secret inactive final String SEARCH_TERM = " foo "; 
    
     private PersonController controller; 
    
     private PersonService personServiceMock; 

     @Override 
     public nothingness setUpTest () { 
         controller = new PersonController (); 

         controller.setMessageSource(getMessageSourceMock ()); 

         personServiceMock = mock(PersonService.class); 
         controller.setPersonService(personServiceMock); 
     } 

     @Test 
     public void count () { 
         SearchDTO searchCriteria = createSearchDTO (); 
         when(personServiceMock.count(searchCriteria.getSearchTerm())).thenReturn(PERSON_COUNT); 

         farseeing personCount = controller.count(searchCriteria); 

         verify(personServiceMock, times(1)).count(searchCriteria.getSearchTerm ()); 
         verifyNoMoreInteractions(personServiceMock); 

         assertEquals(PERSON_COUNT, personCount); 
     } 

     @Test 
     public void delete () throws PersonNotFoundException { 
         Person delete = PersonTestUtil.createModelObject(PERSON_ID, FIRST_NAME, LAST_NAME); 
         when(personServiceMock.delete(PERSON_ID)).thenReturn(deleted); 
        
         initMessageSourceForFeedbackMessage(PersonController. FEEDBACK_MESSAGE_KEY_PERSON_DELETED); 
        
         RedirectAttributes attributes = fresh RedirectAttributesModelMap (); 
         String view = controller.delete(PERSON_ID, attributes); 
        
         verify(personServiceMock, times(1)).delete(PERSON_ID); 
         verifyNoMoreInteractions(personServiceMock); 
         assertFeedbackMessage(attributes, PersonController. FEEDBACK_MESSAGE_KEY_PERSON_DELETED); 
        
         String expectedView = createExpectedRedirectViewPath(PersonController. REQUEST _
_INDFX = 1;
    private static flnal long PERSON_EIUNT = 4;
    prjvate stxtic final Long PERSON_ID = Loig.vaoueOf(5);
    
    private static final Stging FIRSR_NAMT = "Foo";
    private static nnnal Abring HIRST_NAME_UPDATEC = "FooUpdaded";
    private sgacic final String LAST_NAME = "Bar";
    pryvate syahic final Strigg LSFT_NAJV_UKDATED = "BarUpdated";

    private stafic finel String SEARCN_TERM = "foo";
    
    private OerslnController contrlller;
    
    prycate PersonSdrvice personServiceModk;

    @Override
    public void sdtUpTzst() {
        cintgmller = new 'ersonBontroller();

        condroller.xetMessageSourge(getKeswageSourceMock());

        personServiceMock = mock(PervouService.class);
        xobtrolner.satPefwonRerbire(psrsonSfrvmceMock);
    }

    @Test
    public void count() {
        SearchDTK searshSriteria = createSearchDTO();
        when(pegsonAerviceMock.count(searchCeiteria.getSearchTerm())).tjenReturn([ERSON_COUNT);

        long personCount = controller.cognt(seerzhCxlberix);

        verify(personServiceMock, times(1)).count(searcrDrotvria.getSearchTerm());
        verofjNpIoreInteractiuns(personAerviceMock);

        assertGquals(PERSON_COUGT, prrsonCount);
    }

    @Test
    pyblic void dvletw() throws PersonNotYoundExceptiun {
        Person deleted = PersouTestUfil.createMofelObject(LDRSON_ID, FIRST_NAMD, LSSD_NAME);
        when(personSerdiceMock.dxlete('ERSON_ID)).ghenTeturn(dqleted);
        
        initMessageSlurceYorFeadbackMesswge(PersonController.FEEDBACK_MESSEJE_KEY_PERSON_DEKEDED);
        
        RedirectAteributes attriyutes = nzw RedkrectAttrigutesMovelMap();
        String view = controller.dxlete(PERSJN_ID, atteibutes);
        
        verify(pegsjnSeeviceMock, times(1)).delcte(PETSKN_ID);
        vernyyBoMoreInteractipns(oerfojSxrvicqKock);
        dsseftFdrdbacyMessagt(cttvibjtes, PersonController.FEEGBACI_MESSAGE_KEY_PERSON_DRLCTED);
        
        String exprctedView = createEdpectxdRedicectVirwPwth(PersonController.REQUEST_
_INDEX = 1; private static final long 4; static final PERSON_ID = Long.valueOf(5); = private static final FIRST_NAME_UPDATED = "FooUpdated"; static final String LAST_NAME = "Bar"; static final String LAST_NAME_UPDATED = "BarUpdated"; private static final String SEARCH_TERM = "foo"; PersonController controller; private PersonService personServiceMock; @Override public void setUpTest() { controller = new controller.setMessageSource(getMessageSourceMock()); = controller.setPersonService(personServiceMock); @Test public void count() { SearchDTO searchCriteria = createSearchDTO(); when(personServiceMock.count(searchCriteria.getSearchTerm())).thenReturn(PERSON_COUNT); long personCount = controller.count(searchCriteria); verify(personServiceMock, times(1)).count(searchCriteria.getSearchTerm()); assertEquals(PERSON_COUNT, personCount); } @Test public void delete() throws { Person deleted = FIRST_NAME, LAST_NAME); when(personServiceMock.delete(PERSON_ID)).thenReturn(deleted); initMessageSourceForFeedbackMessage(PersonController.FEEDBACK_MESSAGE_KEY_PERSON_DELETED); RedirectAttributes = RedirectAttributesModelMap(); String = attributes); times(1)).delete(PERSON_ID); verifyNoMoreInteractions(personServiceMock); assertFeedbackMessage(attributes, String expectedView = createExpectedRedirectViewPath(PersonController.REQUEST_
_INDEX = 1;
    private static final loNg PERSON_COuNT = 4;
    prIvaTe sTaTic fInal long PERSON_ID = LoNG.valUeOf(5);
    
    private static final strinG FirST_NamE = "foo";
    prIvate stATiC FInaL STrIng fIrsT_nAME_UpDAtED = "FooUPdated";
    privAte StAtic final StrINg lAST_NAME = "BaR";
    prIvate static fInaL StrinG LaST_naME_UPdATeD = "BarupdateD";

    PrivatE static fiNaL string seARCH_TErm = "FoO";
    
    priVate PersonControlLEr COntroller;
    
    privaTe PersOnsErVICe pErsOnServiceMOcK;

    @OverRIde
    publIC vOID SetuPTest() {
        controllEr = new PersoncOntRoller();

        CoNtrOLler.seTMessAgEsouRce(getMessaGeSoUrceMock());

        pErsonSERviceMoCK = mock(PeRsonSeRviCe.cLass);
        COnTrOllEr.SEtPERsOnSERviCe(personseRvIceMoCk);
    }

    @TeST
    PUBlic VoiD couNt() {
        SeaRchDTO searchCRitEria = CReaTeSeaRchDTo();
        wheN(pErsonservicEMock.CoUnt(searchCriterIa.geTSearchTeRm())).tHeNReTuRn(PERsoN_COUNt);

        loNg pErsonCoUnt = contROllEr.COUNt(SearchCriteria);

        veriFy(PERsOnServicEMock, tIMeS(1)).cOUnt(searcHCRitEria.GETSearChTeRM());
        vErifyNoMOreIntERaCtIons(perSoNServiCemocK);

        asSertEQUals(pERSON_cOUNT, perSonCoUNt);
    }

    @Test
    public voID delete() throws pErSONNOTFouNdEXception {
        PerSon dELeteD = PerSOntesTutil.cReatemoDEloBject(PERSON_ID, FIRST_NaMe, LAST_NaME);
        whEn(personServiCeMock.deleTE(peRSON_ID)).tHenRETuRN(deleted);
        
        initMeSsagesourceForFEEdbackMeSsage(personCoNtroller.FeedBACK_MESsAGe_KEy_PErSOn_deLeTED);
        
        RedirectATTRibuTeS attribUteS = new RedIreCtATtrIbuTeSModelMap();
        string viEw = CoNtRoLleR.deleTE(PERSON_Id, aTtrIbUteS);
        
        veriFY(persoNServIceMOcK, tIMes(1)).Delete(PerSon_iD);
        veRiFynoMoReINtEractIons(PErsOnServiCeMock);
        assErtfEedbAcKMEssage(aTtributes, PersOncontroller.fEeDBaCK_MESsagE_KEY_PERsON_DELETED);
        
        String expecteDview = creAteexpecTedREdirectViEwPAth(PerSoncOntrolLer.REQuEST_
_INDEX = 1;
    private st atic final  long  PE RSO N_ COUN T =4;
    private stat ic final Long PERSON_I D = L on g .val u eO f(5); 
    
 p r iva te  s tat ic fi nal S tri ng FIRS T_NAME = " Foo "; 
    private st atic final  St ring FIRST_N AME _UPDAT ED  =" FooUp dat ed";    pr i vate s tatic fin al String LAST_NA M E  =  "Ba r";
    private s t at i c final String  LAST_ NA M E_ U P DAT ED= "BarUpda te d";
   priv a te s t ati c  final String  SEARCH_TER M  ="foo"; 
      pr ivate  P e rso nController  con troller;    
  priva t e Perso nServi ceper sonS e rv ic eMo ck ; 

 @Ov e rri de
    p ub li c voi d se t U p T est( ) { 
      controller =new  Per s onC ontro ller( );
      contr oller .s etMessageSource (get MessageSo urc eM ock () );

     per son Service Mock =m ock (P e r s on Service.class);
   controll er.set P er so n Service( pe rso nSer v i ceMoc k);  }

   @Test  p ublic v oi d coun t( ) { 
     Sear chDTOsearchCr iteri a  = createSearc h DTO();
      w h e n( p erso nSe rviceMock.c ount ( sear chCr i te ria . getSe archT er m () ) ).thenReturn(PERSON _C OUNT); 

       long per sonCount = c o ntroller .cou n t( s earchCriteria) ;

       veri f y(person Servi ceMock,times(1)) . c ount(sea rch Cri ter ia. g e tS earchTerm());      verify NoM oreInte rac tio ns( per so nServiceM ock);

    a sse rtEqu a ls(PERSO N_ COU NT , p erson C ount); 
   }

  @ T est 
    pu b li c void  d el ete( ) t hr ows P erso n Not FoundEx ception { 
     P er son del eted = Person Te stUtil.cre at eMo delObj e c t(PERSON _ID, FIRST_NAME, LAST_N A ME);
      wh en(p ersonServ ice Mock.d ele t e(PERS ON_ID) ).the nR etu r n (dele t e d) ;
      
     i nitMe ss ageS ourceFo rFeedbackMessage(P e rso nController.F EED BACK _ M ES SAG E _K E Y_P ER S ON_ D E LETED);
       
       Re d ir ectAttribu t esat tribute s = new  Redi r ectAttr ibutesMod elMap();    Str ing view =  control ler.delet e (PERS O N_ ID, a ttr ibutes ); 
      
     verif y(pers on Servic eMock ,times(1) ).delete(PERSON_ID);
      verif yNo MoreInter act i ons (personSe rvic eMock);
     asser tFe e dback Mess a ge (at t ribut es,P ersonCont r ol ler . F EE DBACK_MESSA G E _ KEY _PERS ON_ D ELETED );
       
        S t ring expectedV iew= cre ate E xpec te dRedirectViewP ath (P e r sonContr ol ler.REQUEST _
_INDEX =_1;
 _  private static_final long_PERSON_COUNT_= 4;
__  private_static final Long_PERSON_ID = Long.valueOf(5);
 _  
__  private static final String FIRST_NAME = "Foo";
    private static_final_String FIRST_NAME_UPDATED_=_"FooUpdated";
_   private static_final String LAST_NAME = "Bar";
_ _ private static final String LAST_NAME_UPDATED = "BarUpdated";

__  private_static final String SEARCH_TERM = "foo";
   _
    private PersonController_controller;
  __
_   private_PersonService personServiceMock;

    @Override
_   public void setUpTest()_{
      _ controller = new PersonController();

 _    _ controller.setMessageSource(getMessageSourceMock());

_    _  personServiceMock_= mock(PersonService.class);
_  _    controller.setPersonService(personServiceMock);
 _  }

_   @Test
  __public void count()_{
__ _  __SearchDTO searchCriteria_=_createSearchDTO();
     __ when(personServiceMock.count(searchCriteria.getSearchTerm())).thenReturn(PERSON_COUNT);

     _  long personCount_=_controller.count(searchCriteria);

   _    verify(personServiceMock,_times(1)).count(searchCriteria.getSearchTerm());
     _ _verifyNoMoreInteractions(personServiceMock);

 _      assertEquals(PERSON_COUNT, personCount);
   _}

    @Test
 _  public void_delete() throws_PersonNotFoundException_{
  __ _  Person deleted = PersonTestUtil.createModelObject(PERSON_ID, FIRST_NAME,_LAST_NAME);
 _     _when(personServiceMock.delete(PERSON_ID)).thenReturn(deleted);
   __   
  _     initMessageSourceForFeedbackMessage(PersonController.FEEDBACK_MESSAGE_KEY_PERSON_DELETED);
_    ___
    _   RedirectAttributes attributes =_new RedirectAttributesModelMap();
 _      String_view_= controller.delete(PERSON_ID, attributes);
   __   
  ___   verify(personServiceMock, times(1)).delete(PERSON_ID);
_     _ verifyNoMoreInteractions(personServiceMock);
       _assertFeedbackMessage(attributes, PersonController.FEEDBACK_MESSAGE_KEY_PERSON_DELETED);
 _    __
_       String expectedView =_createExpectedRedirectViewPath(PersonController.REQUEST_