/** Tests expected behavior when no gene results are found. */ @Test public void searchPathwayNoResults() { bioDbNetRemoteService = mock(BioDbNetRemoteService.class); when(bioDbNetRemoteService.db2db(any(Db2DbParams.class))) .thenAnswer( new Answer<String>() { @Override public String answer(InvocationOnMock invocation) throws Throwable { return "Gene Symbol Biocarta Pathway Name"; } }); BioDbNetSearchImpl bioDbNetSvc = new BioDbNetSearchImpl(); bioDbNetSvc.setBioDbNetRemoteService(bioDbNetRemoteService); action.setBioDbNetService(bioDbNetSvc); action.getSearchParameters().setSearchType(SearchType.PATHWAY_BY_GENE); action.getSearchParameters().setInputValues(StringUtils.EMPTY); assertEquals(PATHWAY_RESULTS, action.search()); assertTrue(action.getGeneResults().isEmpty()); assertTrue(action.hasActionErrors()); assertEquals(1, action.getActionErrors().size()); assertEquals("bioDbNet.noPathwayResultsFound", action.getActionErrors().iterator().next()); }
/** {@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(); }