|
@@ -7,7 +7,7 @@ import com.mooctest.crowd.site.command.CrowdTestProjectCommand;
|
|
import com.mooctest.crowd.site.command.CrowdTestReportCommand;
|
|
import com.mooctest.crowd.site.command.CrowdTestReportCommand;
|
|
import com.mooctest.crowd.site.command.CrowdTestTaskCommand;
|
|
import com.mooctest.crowd.site.command.CrowdTestTaskCommand;
|
|
import com.mooctest.crowd.site.data.dto.*;
|
|
import com.mooctest.crowd.site.data.dto.*;
|
|
-import com.mooctest.crowd.site.mediator.Mediator;
|
|
|
|
|
|
+import com.mooctest.crowd.site.mediator.ViewMediator;
|
|
import org.junit.Before;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runner.RunWith;
|
|
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertNotNull;
|
|
public class WebMediatorImplTest {
|
|
public class WebMediatorImplTest {
|
|
|
|
|
|
|
|
|
|
- private Mediator mediator;
|
|
|
|
|
|
+ private ViewMediator viewMediator;
|
|
private Account account;
|
|
private Account account;
|
|
|
|
|
|
@Before
|
|
@Before
|
|
@@ -34,7 +34,7 @@ public class WebMediatorImplTest {
|
|
account.setPassword("CORRECT_PWD");
|
|
account.setPassword("CORRECT_PWD");
|
|
account.setMobileNum("EXiSTS_MOBILE");
|
|
account.setMobileNum("EXiSTS_MOBILE");
|
|
|
|
|
|
- mediator = new WebMediatorImpl();
|
|
|
|
|
|
+ viewMediator = new WebMediatorImpl();
|
|
}
|
|
}
|
|
|
|
|
|
// @Test
|
|
// @Test
|
|
@@ -44,7 +44,7 @@ public class WebMediatorImplTest {
|
|
// PowerMockito.when(AccountFactory.createAccount()).thenReturn(account);
|
|
// PowerMockito.when(AccountFactory.createAccount()).thenReturn(account);
|
|
// LoginCommand cmd = new LoginCommand("EXiSTS_MOBILE", "CORRECT_PWD", "CODE");
|
|
// LoginCommand cmd = new LoginCommand("EXiSTS_MOBILE", "CORRECT_PWD", "CODE");
|
|
// //action
|
|
// //action
|
|
-// UserDTO success = mediator.loginByMobileAndPwd(cmd);
|
|
|
|
|
|
+// UserDTO success = viewMediator.loginByMobileAndPwd(cmd);
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
@@ -53,7 +53,7 @@ public class WebMediatorImplTest {
|
|
public void should_return_index_dto_when_render_index(){
|
|
public void should_return_index_dto_when_render_index(){
|
|
//arrange
|
|
//arrange
|
|
//action
|
|
//action
|
|
- IndexDTO indexDTO = mediator.renderIndex();
|
|
|
|
|
|
+ IndexDTO indexDTO = viewMediator.renderIndex();
|
|
//assert
|
|
//assert
|
|
assertNotNull(indexDTO);
|
|
assertNotNull(indexDTO);
|
|
}
|
|
}
|
|
@@ -63,27 +63,19 @@ public class WebMediatorImplTest {
|
|
//arrange
|
|
//arrange
|
|
AccountCommand accountCommand = new AccountCommand();
|
|
AccountCommand accountCommand = new AccountCommand();
|
|
//action
|
|
//action
|
|
- MyCrowdDTO myCrowdDTO = mediator.renderMyCrowd(accountCommand);
|
|
|
|
|
|
+ MyCrowdDTO myCrowdDTO = viewMediator.renderMyCrowd(accountCommand);
|
|
//assert
|
|
//assert
|
|
assertNotNull(myCrowdDTO);
|
|
assertNotNull(myCrowdDTO);
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
- public void should_return_project_details_dto_when_render_project_details_success(){
|
|
|
|
- //arrange
|
|
|
|
- CrowdTestProjectCommand crowdTestProjectCommand = new CrowdTestProjectCommand();
|
|
|
|
- //action
|
|
|
|
- ProjectDetailsDTO projectDetailsDTO = mediator.renderProjectDetails(crowdTestProjectCommand);
|
|
|
|
- //assert
|
|
|
|
- assertNotNull(projectDetailsDTO);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void should_return_task_square_dto_when_render_task_square_success(){
|
|
public void should_return_task_square_dto_when_render_task_square_success(){
|
|
//arrange
|
|
//arrange
|
|
CrowdTestTaskCommand crowdTestTaskCommand = new CrowdTestTaskCommand();
|
|
CrowdTestTaskCommand crowdTestTaskCommand = new CrowdTestTaskCommand();
|
|
//action
|
|
//action
|
|
- TaskSquareDTO taskSquareDTO = mediator.renderTaskSquare(crowdTestTaskCommand);
|
|
|
|
|
|
+ TaskSquareDTO taskSquareDTO = viewMediator.renderTaskSquare(crowdTestTaskCommand);
|
|
//assert
|
|
//assert
|
|
assertNotNull(taskSquareDTO);
|
|
assertNotNull(taskSquareDTO);
|
|
}
|
|
}
|
|
@@ -93,7 +85,7 @@ public class WebMediatorImplTest {
|
|
//arrange
|
|
//arrange
|
|
CrowdTestReportCommand crowdTestReportCommand = new CrowdTestReportCommand();
|
|
CrowdTestReportCommand crowdTestReportCommand = new CrowdTestReportCommand();
|
|
//action
|
|
//action
|
|
- ReportDetailsDTO reportDetailsDTO = mediator.renderReportDetails(crowdTestReportCommand);
|
|
|
|
|
|
+ ReportDetailsDTO reportDetailsDTO = viewMediator.renderReportDetails(crowdTestReportCommand);
|
|
//assert
|
|
//assert
|
|
assertNotNull(reportDetailsDTO);
|
|
assertNotNull(reportDetailsDTO);
|
|
}
|
|
}
|
|
@@ -103,7 +95,7 @@ public class WebMediatorImplTest {
|
|
//arrange
|
|
//arrange
|
|
CrowdTestTaskCommand crowdTestTaskCommand = new CrowdTestTaskCommand();
|
|
CrowdTestTaskCommand crowdTestTaskCommand = new CrowdTestTaskCommand();
|
|
//action
|
|
//action
|
|
- TaskDetailsDTO taskDetailsDTO = mediator.renderTaskDetails(crowdTestTaskCommand);
|
|
|
|
|
|
+ TaskDetailsDTO taskDetailsDTO = viewMediator.renderTaskDetails(crowdTestTaskCommand);
|
|
//assert
|
|
//assert
|
|
assertNotNull(taskDetailsDTO);
|
|
assertNotNull(taskDetailsDTO);
|
|
}
|
|
}
|
|
@@ -113,7 +105,7 @@ public class WebMediatorImplTest {
|
|
//arrage
|
|
//arrage
|
|
AccountCommand accountCommand = new AccountCommand();
|
|
AccountCommand accountCommand = new AccountCommand();
|
|
//action
|
|
//action
|
|
- UserDTO userDTO = mediator.renderUser(accountCommand);
|
|
|
|
|
|
+ UserDTO userDTO = viewMediator.renderUser(accountCommand);
|
|
//assert
|
|
//assert
|
|
assertNotNull(userDTO);
|
|
assertNotNull(userDTO);
|
|
}
|
|
}
|