Package com.google.testing.testify.risk.frontend.client.view

Examples of com.google.testing.testify.risk.frontend.client.view.CapabilitiesView


public class CapabilitiesPresenterTest extends TestCase {

  // Unit test the handshake between View and Presenter.
  @SuppressWarnings("unchecked")
  public void testInitialization() {
    CapabilitiesView mockView = EasyMock.createMock(CapabilitiesView.class);
    ProjectRpcAsync projectService = EasyMock.createMock(ProjectRpcAsync.class);
    UserRpcAsync securityService = EasyMock.createMock(UserRpcAsync.class);
    SimpleEventBus mockEventBus = EasyMock.createMock(SimpleEventBus.class);
    Project testProject = new Project();
    testProject.setProjectId(42L);

    ArrayList<Component> components = Lists.newArrayList();
    ArrayList<Attribute> attributes = Lists.newArrayList();
    ArrayList<Capability> capabilities = Lists.newArrayList();
    Collection<String> labels = Lists.newArrayList();
   
    // Verify the initialization steps, ensure the async callbacks return the expected collections.
    securityService.hasEditAccess(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(true);

    projectService.getProjectAttributes(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(capabilities);

    projectService.getProjectComponents(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(components);

    projectService.getProjectCapabilities(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(capabilities);

    projectService.getLabels(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(labels);

    mockView.setEditable(true);
    mockView.setPresenter(EasyMock.isA(CapabilitiesPresenter.class));
    mockView.setComponents(components);
    mockView.setAttributes(attributes);
    mockView.setCapabilities(capabilities);
    mockView.setProjectLabels(labels);

    EasyMock.replay(mockView, projectService, securityService);

    CapabilitiesPresenter testPresenter = null;
    testPresenter = new CapabilitiesPresenter(testProject, projectService, securityService,
View Full Code Here

TOP

Related Classes of com.google.testing.testify.risk.frontend.client.view.CapabilitiesView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.