Tải bản đầy đủ - 0 (trang)
enterhours.jsp: Swith to Include File and Timex Tag Library

enterhours.jsp: Swith to Include File and Timex Tag Library

Tải bản đầy đủ - 0trang

*TestClassesandTimexTestCase

Mostofourearlier*Testclasseslookedsomethinglikethe

followingcodesnippetfromouroriginalTimesheetManagerTest

class:



publicclassTimesheetManagerTestextendsTestCase

{

TimesheetManagertimesheetManager=newTimesheetManager();

publicstaticvoidmain(Stringargs[])



Now,insteadofextendingtheJUnitTestCaseclassdirectly,we

extendtheTimexTestCaseclass(inthetimex2/directory),asshown

next:

publicclassTimesheetManagerTestextendsTimexTestCase

{

publicstaticvoidmain(Stringargs[])



Thebenefitofthisapproachisthatwecanputallthefixture

codeinaparentclass(suchasTimexTestCase),sothetest

subclassescanfocusontheunittestsversusfixturecode(visit

junit.orgfordetailsonfixturecode).







DateUtil.java:NewMethod

Addednewmethodforusewithtimextaglibrary.



publicstaticbooleanisInCurrentPayPeriod(DatecheckDate)

{

DateweekStartDate=getDateWithZeroTime(getCurrentPeriodSt

DateweekEndDate=getDateWithMaxTime(getCurrentPeriodEndin

return(!checkDate.before(weekStartDate)&&!checkDate

.after(weekEndDate));

}



timex.css:NewStyles

Addedsomenewstyles.

thead{background-color:#D0D6EA;}

.tableborder{border:thin;}

.tdright{text-align:right;}

.tdcenter{text-align:center;}

.even{background-color:#F1F8FE}







timexhsqldb.xml:BadDataDefectFix

FixedpasswordsinSQLINSERTSbecauseofadiscovered

defectintestdata(notcode).Chapter3,"XPandAMDD-Based

ArchitectureandDesignModeling,"hasanacceptancetestthat

indicates"Thepasswordmustbebetween8and10characters."

Theoriginalpasswordswerefewerthan8characters,thereby

notallowingausertologin.



INSERTINTOEmployee(employeeId,name,employeeCode,

password,email,managerEmployeeId)

VALUES(2,'AjayKumar','H','visualpatterns','akumar@

INSERTINTOEmployee(employeeId,name,employeeCode,

password,email,managerEmployeeId)

VALUES(3,'TeresaWalker','M','agilestuff','twalker@

INSERTINTOEmployee(employeeId,name,employeeCode,

password,email)

VALUES(4,'TomBrady','E','superbowl','tbrady@acme.c



Itisimportanttonotethatdefectsarenotalwayscoderelated;

theycanalsoberelatedtobaddata.







C.JavaCodeConventions

THEFOLLOWINGARESOMEOFTHEGUIDELINESIlikeanduse

fromtheCodeConventionsfortheJavaProgrammingLanguage

prescribedbySunonthejava.sun.comwebsite.(Note:There

aremanymoreconventionsrecommendedbySun,sobesure

tovisitthiswebsite.)

AllsourcefileswillhaveabeginningJavadoccomment.

Thefirstlineofcodeinthesourcefilewillbethepackage

statementfollowedbyanyimportstatements.

Packagenamesshouldbeginwithalowercasetop-level

domainname(forexample,com.oredu.).

Classandinterfacenamesshouldbenounsandshoulduse

amixedcasewitheachwordbeingcapitalized(forexample,

EmployeeHours).

Allclassfilesshouldhavethefollowingintheorderlisted

here:

HaveaJavadocfortheclass.

Listvariablesasfollows:staticvariables,instance

variables(public,protected,noaccessspecified,and

thenprivate).

Listmethodsasfollows:constructorsandthenmethods

(methodsshouldbegroupedbyfunctionality,not

scope).



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

enterhours.jsp: Swith to Include File and Timex Tag Library

Tải bản đầy đủ ngay(0 tr)

×