コード例 #1
0
  /** {@inheritDoc} */
  @Before
  @Override
  public void setUp() throws Exception {
    super.setUp();
    BioDbNetSearchImpl bioDbNetSvc = new BioDbNetSearchImpl();
    bioDbNetSvc.setBioDbNetRemoteService(bioDbNetRemoteService);

    action = new BioDbNetSearchAction();
    action.setBioDbNetService(bioDbNetSvc);
    action.setWorkspaceService(workspaceService);
    action.prepare();
  }
コード例 #2
0
  /** Tests action validation. */
  @Test
  public void validate() {
    action.validate();
    assertTrue(action.hasActionErrors());
    assertEquals(1, action.getActionErrors().size());
    assertEquals(
        "struts.messages.error.must.enter.keywords", action.getActionErrors().iterator().next());

    action.clearActionErrors();
    action.prepare();
    action.getSearchParameters().setInputValues("input");
    action.validate();
    assertFalse(action.hasActionErrors());
  }