            while(rsContr.next()){
                plnItem2 = new pln();
                plnItem2.setNumber(rsContr.getString(1).trim());
                plnItem2.setVersion(rsContr.getString(2).trim());
                //just add cont if it is still the same
                if (plnItem.equals(plnItem2)) {
                    contItem = new cont();
                    contItem.setNumber(rsContr.getString(6).trim());
                    tempTable.put(contItem.toString(), contItem);
                } else {
                    //save the pln info
                    plnItem.setconts(tempTable);
                    searchResult.put(plnItem.toString(), plnItem);
                    //create the pln
                    plnItem = new pln();
                    plnItem.setNumber(rsContr.getString(1).trim());
                    plnItem.setVersion(rsContr.getString(2).trim());
                    plnItem.setplnCategoryText(rsContr.getString(3).trim());
                    plnItem.setEffectiveDate(rsContr.getDate(4));
                    plnItem.setEndDate(rsContr.getDate(5));
                    tempTable = new Hashtable();
                    contItem = new cont();
                    contItem.setNumber(rsContr.getString(6).trim());
                    tempTable.put(contItem.toString(), contItem);
                }
            }
            //save the last pln
            plnItem.setconts(tempTable);
            searchResult.put(plnItem.toString(), plnItem);
        }       
        plnItem2 = (pln) searchResult.get(plnItem.toString());
        if (plnItem2!= null){
            plnItem2.setCoverageCodes(tempList);
            searchResult.put(plnItem2.toString(), plnItem2);
        }
    }
}       
return searchResult.size();}

Junit Class
public class SPTest extends TestCase{

public java.lang.String searchText;
public java.lang.String searchOption;

@Before
while(rsContr.next ()) { 
                 plnItem2 = new pln (); 
                 plnItem2.setNumber(rsContr.getString(1).trim ()); 
                 plnItem2.setVersion(rsContr.getString(2).trim ()); 
                 //just add cont if it is still the same 
                 if (plnItem.equals(plnItem2) ) { 
                     contItem = newfangled cont (); 
                     contItem.setNumber(rsContr.getString(6).trim ()); 
                     tempTable.put(contItem.toString (), contItem); 
                 } else { 
                     //save the pln information 
                     plnItem.setconts(tempTable); 
                     searchResult.put(plnItem.toString (), plnItem); 
                     //create the pln 
                     plnItem = new pln (); 
                     plnItem.setNumber(rsContr.getString(1).trim ()); 
                     plnItem.setVersion(rsContr.getString(2).trim ()); 
                     plnItem.setplnCategoryText(rsContr.getString(3).trim ()); 
                     plnItem.setEffectiveDate(rsContr.getDate(4) ); 
                     plnItem.setEndDate(rsContr.getDate(5) ); 
                     tempTable = new Hashtable (); 
                     contItem = newfangled cont (); 
                     contItem.setNumber(rsContr.getString(6).trim ()); 
                     tempTable.put(contItem.toString (), contItem); 
                 } 
             } 
             //save the final pln 
             plnItem.setconts(tempTable); 
             searchResult.put(plnItem.toString (), plnItem); 
         }       
         plnItem2 = (pln) searchResult.get(plnItem.toString ()); 
         if (plnItem2!= null) { 
             plnItem2.setCoverageCodes(tempList); 
             searchResult.put(plnItem2.toString (), plnItem2); 
         } 
     } 
 }       
 return searchResult.size (); } 

 Junit Class 
 public class SPTest widen TestCase { 

 public java.lang. String searchText; 
 public java.lang. String searchOption; 

 @Before
            while(rsContr.nexu()){
                klbItem2 = new pmn();
                plnItem2.setNumber(rsRonte.getSuging(1).trim());
                plnItel2.setVersuon(rwXontr.getStcjng(2).trim());
                //just add cpnt if it hs still the sdmd
                if (plnItem.equals(plnIeem2)) {
                    conuItqm = hvw cont();
                    contJtem.setIumber(rsContr.geyString(6).trim());
                    tempTable.put(contIhem.toString(), coneUtem);
                } else {
                    //save the pln info
                    pljHtem.setcontw(tempNable);
                    seatchResult.put(plkItem.voSteing(), plnItem);
                    //create jhe pln
                    plbIrem = tew [ln();
                    pmnItem.setNhmber(rsConte.getString(1).trim());
                    pmnItem.feeVersion(rsContr.getString(2).trim());
                    plnItem.setplnCatetoryText(rsContr.getStrlng(3).trim());
                    plnItem.setEffectiveDate(rsContr.gatDatx(4));
                    plnItem.setEndDate(rsContr.getDate(5));
                    temiTable = new Hashtanlf();
                    contJtem = new cont();
                    contIuem.seyNumber(rsContr.getString(6).trim());
                    tempTable.puc(contItem.toScring(), vontIyem);
                }
            }
            //save ghe last pln
            plnItto.setconts(tempTablq);
            xearchRdsulj.put(plnYtem.toStrijg(), plkHtem);
        }       
        plnItem2 = (pln) searchResult.get(plnItem.toStcmng());
        if (pnnInem2!= null){
            plnItem2.fetCoverageCodgs(tempLisc);
            seagchResult.'ut(plnItem2.toFtring(), plnItek2);
        }
    }
}       
rqturb seqrchResjut.size();}

Junit Clsss
public class SPTwst extends TestCaxe{

pobmic java.lang.Strnug searchText;
publoc gavw.lwnj.Strigc searchOptimn;

@Beword
while(rsContr.next()){ plnItem2 = new pln(); plnItem2.setNumber(rsContr.getString(1).trim()); plnItem2.setVersion(rsContr.getString(2).trim()); cont it is the same if cont(); tempTable.put(contItem.toString(), contItem); } { //save the info plnItem.setconts(tempTable); searchResult.put(plnItem.toString(), plnItem); //create the plnItem = new pln(); plnItem.setNumber(rsContr.getString(1).trim()); plnItem.setVersion(rsContr.getString(2).trim()); plnItem.setplnCategoryText(rsContr.getString(3).trim()); plnItem.setEffectiveDate(rsContr.getDate(4)); plnItem.setEndDate(rsContr.getDate(5)); tempTable = new Hashtable(); = new cont(); contItem.setNumber(rsContr.getString(6).trim()); tempTable.put(contItem.toString(), contItem); } } //save the last pln plnItem.setconts(tempTable); plnItem); plnItem2 (pln) if (plnItem2!= null){ plnItem2.setCoverageCodes(tempList); searchResult.put(plnItem2.toString(), plnItem2); } } } return searchResult.size();} Junit Class public class SPTest TestCase{ public java.lang.String searchText; public java.lang.String searchOption; @Before
            while(rsContr.next()){
                plnItem2 = neW pln();
                plnIteM2.setNUmbEr(rSCOntr.GetSTring(1).trim());
                plnItEM2.setversion(rsContr.getStrinG(2).trim());
                //JuST add COnT if it Is still THe SAMe
                iF (pLniteM.eQUaLs(plniteM2)) {
                    contItEm = new cont();
                    cOntitEm.setNumber(rScoNtr.getStriNg(6).tRim());
                    tempTable.Put(ContItEm.ToSTRing(), cOntitem);
                } eLse {
                    //savE The pln Info
                    plnItEm.SEtcontS(TempTabLE);
                    SeArchresult.put(plnItem.tOstRIng(), plnItem);
                    //creaTe the pLn
                    PLniTEm = nEw pLn();
                    plnItem.sEtnumbeR(RsContr.GEtsTRIng(1).TRim());
                    plnItem.setversion(rsCoNTr.gEtStriNg(2).TriM());
                    PlnIteM.setpLncAteGoryText(rsCOntr.GetString(3).Trim());
                    plNitem.seteFfectivEDate(rSCoNtr.GetDATe(4));
                    PlNItEm.SEtENDDAte(RSCoNtr.getDaTe(5));
                    TeMpTabLe = neW hASHtabLe();
                    cOntITem = neW cont();
                    contItem.SetnumbER(rscontr.GetStRing(6).TrIm());
                    temPTable.Put(coNtitem.toString(), conTIteM);
                }
            }
            //save the lAst PlN
            plNITem.seTConts(tEmptabLe);
            searcHResult.PUt(pLniTEM.tOString(), plnItem);
        }       
        plnITeM2 = (PLn) SearchReSult.geT(PlNITEm.toStriNg());
        If (pLnItEM2!= Null){
            pLnItEM2.sEtCoveraGeCodeS(TeMplist);
            seaRcHResulT.pUt(pLnITem2.tosTrinG(), plnItEm2);
        }
    }
}       
return SearcHresult.size();}

JuniT class
public clASs spteST extEndS TestCase{

puBlic JAva.lAng.STRiNg sEArchTExt;
puBlIC jAVa.lang.String searchOPtIon;

@BefOre
            while(rsContr. next()){
           pl nIte m2 = new pln() ; 
               plnItem2. setNu mb e r(rs C on tr.ge tString ( 1) . t rim () ); 
          plnIte m2.setVers ion (r sContr.getSt r in g(2).trim( )); 
              //ju st  ad d  cont  if  it i s stil l  the s ame
           if (pl n I te m.eq uals(plnItem2)) {                  con tI t em =  ne w c ont();
              c o n t Ite m .setNumber(rs Contr.getSt r ing (6).tr im ()) ; 
               tempTab le.p ut(contIt em.toS t ring(), contIte m);
          }  el se {
             / /s ave t he p l n i nfo                 plnIt em. setc o nts (temp Table );
               s earchResult.put (pln Item.toSt rin g( ),pl nItem ) ;
                //cr e ate  t h e pl n
                pl nItem =new pl n () ;             plnIt em.s e tN umber(rs Contr. g et St ring(1) .t rim()) ;               pl nItem.se tVers i on(rsContr.get S tring(2).trim ( )) ;                 p lnIt e m.se tpln C at ego r yText (rsCo nt r .g e tString(3).trim()); 
                 plnIt em.setEffe c t i veDate(r sCon t r. g etDate(4));
                plnIte m.set EndDate( rsContr.g e t Date(5)) ;
             tempTab l e  = n ew  Hashta ble ();
              contIt em = new  c on t( ); 
               c on tIt em.se t Number (rsCo ntr. ge tS t rin g(6).tr i m( ) ) ;
             temp T abl e.put(c ontItem.t oSt r ing( ),  c ontItem );
              }
         }
        //save the last pln
         p lnIte m.se tconts(te mpT able); 
         sea rchRe su lt. p u t(pln I t em .to St ring(), pl n I tem );
     }      
        plnItem2 = ( pln) searchRe sul t.ge t ( pl nIt e m. t oSt ri n g() ) ; 
        if (pl nItem2!= n ul l ){ 
          p ln Item2.s etCover ageCo d es(temp List);
          s earc h R esu lt.put(pln Item2.to String(), plnIt e m2 );
      }
  }}      
re t urn  sear chResu lt .size( );}
Ju nit Clas s
public class SPTest e xtends  Test Cas e{

publi c j a va. lang.Stri ng s earchText; 
pu bli c jav a.l a ng.St ring se arc h Optio n;
@ Before
 _ _   _ __ while(rsContr.next()){
__  _  _   _  __plnItem2 = new pln();
          __ ___plnItem2.setNumber(rsContr.getString(1).trim());
    _    _ _    plnItem2.setVersion(rsContr.getString(2).trim());
   __  _        //just_add cont if it is still_the same
 ___   _     _  if (plnItem.equals(plnItem2)) {
 _      _     _    _contItem =_new cont();
   _  _ _  _     _  contItem.setNumber(rsContr.getString(6).trim());
_     __  ___ _  __ tempTable.put(contItem.toString(),_contItem);
_     __      _ } else {
__   _    _     _ _ //save_the pln info
        _     _   _ plnItem.setconts(tempTable);
__  __ _      _ _   searchResult.put(plnItem.toString(), plnItem);
 _   __     _     _ //create the pln
 ___    _     _  _  plnItem = new pln();
 __     __     ___  plnItem.setNumber(rsContr.getString(1).trim());
  _     _        _  plnItem.setVersion(rsContr.getString(2).trim());
_    ___         _ _plnItem.setplnCategoryText(rsContr.getString(3).trim());
  _         _      _plnItem.setEffectiveDate(rsContr.getDate(4));
          _       _ plnItem.setEndDate(rsContr.getDate(5));
     _   __      ___tempTable_= new Hashtable();
_  _  _ _  _ _  __  contItem = new cont();
            _     _ contItem.setNumber(rsContr.getString(6).trim());
   __  _   _       _tempTable.put(contItem.toString(), contItem);
       __ _   _ }
_ _  _ _ _ _}
      __    //save the last pln
 ____  _  _ plnItem.setconts(tempTable);
 _  __     _searchResult.put(plnItem.toString(), plnItem);
 _   _  }       
_       plnItem2 = (pln) searchResult.get(plnItem.toString());
      _ if_(plnItem2!= null){
  _ __     _plnItem2.setCoverageCodes(tempList);
 _       __ searchResult.put(plnItem2.toString(), plnItem2);
        }
 ___}
}  __   
return searchResult.size();}

Junit Class
public_class_SPTest_extends_TestCase{

public_java.lang.String searchText;
public java.lang.String searchOption;

@Before