Skip to content

Commit

Permalink
Merge pull request #60 from nerstak/feature/mockito
Browse files Browse the repository at this point in the history
Feature/mockito
  • Loading branch information
nerstak authored Nov 27, 2020
2 parents 52a172a + aa8a536 commit 8284b5f
Show file tree
Hide file tree
Showing 7 changed files with 614 additions and 32 deletions.
15 changes: 7 additions & 8 deletions src/main/java/control/Details.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
* @param internshipEntity internship
* @return true if the db is updated
*/
private boolean updateAllData(HttpServletRequest request, InternshipEntity internshipEntity){
protected boolean updateAllData(HttpServletRequest request, InternshipEntity internshipEntity){
//Check if update is done, if it not return false
if (!updateInternship(request, internshipEntity)){
return false;
Expand All @@ -93,7 +93,7 @@ private boolean updateAllData(HttpServletRequest request, InternshipEntity inter
* @param internshipEntity internship
* @return true if the db is updated
*/
private boolean updateStudent(HttpServletRequest request, InternshipEntity internshipEntity){
protected boolean updateStudent(HttpServletRequest request, InternshipEntity internshipEntity){
//Student
String studentGroup = request.getParameter("studentGroup");
String studentFirstname = request.getParameter("studentFirstname");
Expand All @@ -120,7 +120,7 @@ private boolean updateStudent(HttpServletRequest request, InternshipEntity inter
* @param internshipEntity internship
* @return true if the db is updated
*/
private boolean updateMarks(HttpServletRequest request, InternshipEntity internshipEntity){
protected boolean updateMarks(HttpServletRequest request, InternshipEntity internshipEntity){
//Marks
String commMark = request.getParameter("commMark");
String techMark = request.getParameter("techMark");
Expand Down Expand Up @@ -151,7 +151,7 @@ private boolean updateMarks(HttpServletRequest request, InternshipEntity interns
* @param request, http request object
* @param internshipEntity internship
*/
private void updateVisit(HttpServletRequest request, InternshipEntity internshipEntity){
protected void updateVisit(HttpServletRequest request, InternshipEntity internshipEntity){
//Visit
boolean visitPlanned = request.getParameter("visitPlanned") != null;
boolean visitDone = request.getParameter("visitDone") != null;
Expand All @@ -169,7 +169,7 @@ private void updateVisit(HttpServletRequest request, InternshipEntity internship
* @param internshipEntity internship
* @return true if the db is updated
*/
private boolean updateInternship(HttpServletRequest request, InternshipEntity internshipEntity){
protected boolean updateInternship(HttpServletRequest request, InternshipEntity internshipEntity){
//Internship
String beginningDate = request.getParameter("beginningDate");
String endDate = request.getParameter("endDate");
Expand All @@ -178,10 +178,9 @@ private boolean updateInternship(HttpServletRequest request, InternshipEntity in
boolean webSurvey = request.getParameter("webSurvey") != null;
boolean companyEval = request.getParameter("companyEval") != null;
boolean cdc = request.getParameter("cdc") != null;
String internshipId = request.getParameter("internshipId");

//Check if all data are not empty and begin date is before end date
if((ProcessString.areStringEmpty(beginningDate, endDate, supervisor, internshipId)) || (ProcessString.isDateBefore(endDate, beginningDate))) {
if((ProcessString.areStringEmpty(beginningDate, endDate, supervisor)) || (ProcessString.isDateBefore(endDate, beginningDate))) {
return false;
}

Expand All @@ -201,7 +200,7 @@ private boolean updateInternship(HttpServletRequest request, InternshipEntity in
* @param request, http request
* @param internshipEntity internship
*/
private void updateFinalReport(HttpServletRequest request, InternshipEntity internshipEntity){
protected void updateFinalReport(HttpServletRequest request, InternshipEntity internshipEntity){
//Report
boolean report = request.getParameter("releasedReport") != null;

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/control/UpdateDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
successRequest = updateStudent(request, internshipEntity);
break;
case "internship":
successRequest = updateInternship(request,internshipEntity );
successRequest = updateInternship(request,internshipEntity);
break;
case "keywords":
successRequest = updateKeywords(request, internshipEntity);
Expand All @@ -73,7 +73,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
* @param internshipEntity internship
* @return true if the database has been updated
*/
private boolean updateCompany(HttpServletRequest request, InternshipEntity internshipEntity){
protected boolean updateCompany(HttpServletRequest request, InternshipEntity internshipEntity){
//Get data from form
//Company
String companyName = request.getParameter("companyName");
Expand Down Expand Up @@ -115,7 +115,7 @@ private boolean updateCompany(HttpServletRequest request, InternshipEntity inter
* @param internshipEntity internship
* @return true if the database has been updated
*/
private boolean updateStudent(HttpServletRequest request, InternshipEntity internshipEntity){
protected boolean updateStudent(HttpServletRequest request, InternshipEntity internshipEntity){
UUID studentId = UUID.fromString(request.getParameter("studentId"));
String group = request.getParameter("group");
String firstName = request.getParameter("firstName");
Expand Down Expand Up @@ -146,7 +146,7 @@ private boolean updateStudent(HttpServletRequest request, InternshipEntity inter
* @param internshipEntity internship
* @return true if the database has been updated
*/
private boolean updateInternship(HttpServletRequest request, InternshipEntity internshipEntity){
protected boolean updateInternship(HttpServletRequest request, InternshipEntity internshipEntity){
String description = request.getParameter("description");
String tutorComments = request.getParameter("tutorComments");
String studentComments = request.getParameter("studentComments");
Expand Down Expand Up @@ -179,7 +179,7 @@ private boolean updateInternship(HttpServletRequest request, InternshipEntity in
* @param internshipEntity Internship entity
* @return true if the database has been updated
*/
private boolean updateSkills(HttpServletRequest request, InternshipEntity internshipEntity) {
protected boolean updateSkills(HttpServletRequest request, InternshipEntity internshipEntity) {
//Get the skill from the form
String skill = request.getParameter("skill");

Expand Down Expand Up @@ -221,7 +221,7 @@ private boolean updateSkills(HttpServletRequest request, InternshipEntity intern
* @param internshipEntity Internship
* @return true if the database has been updated
*/
private boolean updateKeywords(HttpServletRequest request, InternshipEntity internshipEntity){
protected boolean updateKeywords(HttpServletRequest request, InternshipEntity internshipEntity){
//Get the skill from the form
String keyword = request.getParameter("keyword");

Expand Down Expand Up @@ -265,7 +265,7 @@ private boolean updateKeywords(HttpServletRequest request, InternshipEntity inte
* @throws ServletException ServletException
* @throws IOException IOException
*/
private void redirectToDetailsPage(HttpServletRequest request, HttpServletResponse response, InternshipEntity internshipEntity, boolean successRequest) {
protected void redirectToDetailsPage(HttpServletRequest request, HttpServletResponse response, InternshipEntity internshipEntity, boolean successRequest) {
if (successRequest){
request.setAttribute(MESSAGE_ATTRIBUTE, SUCCESS_BD);
}else{
Expand Down
Loading

0 comments on commit 8284b5f

Please sign in to comment.