Commit 0fc2fe62 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

after mockito upgraded anyString behaves differently

parent 4a282dc4
Pipeline #6569 failed with stage
in 7 minutes and 50 seconds
......@@ -162,7 +162,6 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService
LiteEntityList entities = client.getLiteEntity(name, SearchCategory.CHEBI_NAME, MAX_SEARCH_RESULTS_FROM_CHEBI_API,
StarsCategory.ALL);
List<LiteEntity> resultList = entities.getListElement();
for (LiteEntity liteEntity : resultList) {
Entity entity = client.getCompleteEntity(liteEntity.getChebiId());
String chebiName = entity.getChebiAsciiName();
......@@ -187,6 +186,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService
}
entities = client.getLiteEntity(name, SearchCategory.ALL, MAX_SEARCH_RESULTS_FROM_CHEBI_API, StarsCategory.ALL);
resultList = entities.getListElement();
logger.debug(resultList);
for (LiteEntity liteEntity : resultList) {
Entity entity = client.getCompleteEntity(liteEntity.getChebiId());
for (DataItem dataItem : entity.getFormulae()) {
......@@ -426,7 +426,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService
* thrown when there is a problem with accessing information from
* external chebi database
*/
private ChebiWebServiceClient getClient() throws ChebiSearchException {
ChebiWebServiceClient getClient() throws ChebiSearchException {
if (client == null) {
try {
client = new ChebiWebServiceClient();
......@@ -504,4 +504,5 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService
void setClient(ChebiWebServiceClient client) {
this.client = client;
}
}
......@@ -6,6 +6,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
......@@ -288,7 +289,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("invalid xml");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("invalid xml");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetFromId(new MiriamData(MiriamType.CHEMBL_TARGET, "water"));
fail("Exception expected");
......@@ -310,7 +311,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("invalid xml");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("invalid xml");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.findDrug("test");
fail("Exception expected");
......@@ -332,7 +333,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetFromId(new MiriamData(MiriamType.CHEMBL_TARGET, "water"));
fail("Exception expected");
......@@ -394,7 +395,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("<target><unk/></target>");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("<target><unk/></target>");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetFromId(new MiriamData(MiriamType.CHEMBL_TARGET, "water"));
assertEquals(1, getWarnings().size());
......@@ -413,7 +414,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString()))
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
.thenReturn("<target><target_components><target_component/></target_components></target>");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetFromId(new MiriamData(MiriamType.CHEMBL_TARGET, "water"));
......@@ -433,7 +434,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString()))
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
.thenReturn("<target><target_chembl_id>inv id</target_chembl_id></target>");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetFromId(new MiriamData(MiriamType.CHEMBL_TARGET, "water"));
......@@ -829,7 +830,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
// simulate problem with downloading
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.refreshCacheQuery("http://google.pl/");
fail("Exception expected");
......@@ -853,7 +854,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
// simulate problem with downloading
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getDrugsByChemblTarget(new MiriamData());
......@@ -879,7 +880,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
// simulate problem with downloading
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getDrugsByChemblTarget(new MiriamData());
......@@ -907,7 +908,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
// simulate problem with downloading
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.refreshCacheQuery(query);
fail("Exception expected");
......@@ -936,7 +937,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = chemblParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.DOWN, chemblParser.getServiceStatus().getStatus());
} catch (Exception e) {
......@@ -952,7 +953,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = chemblParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString()))
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
.thenReturn("<response><molecules/></response>");
chemblParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.CHANGED, chemblParser.getServiceStatus().getStatus());
......@@ -971,7 +972,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
// valid xml but with empty data
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("<response><molecules>"
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("<response><molecules>"
+ "<molecule><pref_name/><max_phase/><molecule_chembl_id/><molecule_synonyms/></molecule>"
+ "</molecules><mechanisms/><molecule_forms/></response>");
chemblParser.setWebPageDownloader(mockDownloader);
......@@ -1010,7 +1011,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("invalid xml");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("invalid xml");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetsByDrugId(new MiriamData(MiriamType.CHEMBL_COMPOUND, "123"));
fail("Exception expected");
......@@ -1030,7 +1031,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetsByDrugId(new MiriamData(MiriamType.CHEMBL_COMPOUND, "123"));
fail("Exception expected");
......@@ -1050,7 +1051,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getDrugListByTarget(new MiriamData(MiriamType.UNIPROT, "O60391"));
fail("Exception expected");
......@@ -1071,7 +1072,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("invalid xml");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("invalid xml");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getDrugListByTarget(new MiriamData(MiriamType.UNIPROT, "O60391"));
fail("Exception expected");
......@@ -1119,7 +1120,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("invalid xml");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("invalid xml");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getDrugById(new MiriamData(MiriamType.CHEMBL_COMPOUND, ""));
fail("Exception expected");
......@@ -1139,7 +1140,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getDrugById(new MiriamData(MiriamType.CHEMBL_COMPOUND, ""));
fail("Exception expected");
......@@ -1173,7 +1174,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetsForChildElements(new MiriamData());
fail("Exception expected");
......@@ -1193,7 +1194,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("invalid xml");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("invalid xml");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetsForChildElements(new MiriamData());
fail("Exception expected");
......@@ -1213,7 +1214,7 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
try {
chemblParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString()))
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
.thenReturn("<response><molecule_forms><node/></molecule_forms></response>");
chemblParser.setWebPageDownloader(mockDownloader);
chemblParser.getTargetsForChildElements(new MiriamData());
......
......@@ -5,6 +5,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
......@@ -76,7 +77,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
// skip first call to cache, so we will have to at least parse the data
chemicalParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemicalParser.setWebPageDownloader(mockDownloader);
// Parkinson disease
chemicalParser.getChemicalsForDisease(parkinsonDiseaseId);
......@@ -414,7 +415,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
// simulate problem with downloading
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("");
chemicalParser.setWebPageDownloader(mockDownloader);
chemicalParser.refreshCacheQuery(query);
fail("Exception expected");
......@@ -443,7 +444,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = chemicalParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemicalParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.DOWN, chemicalParser.getServiceStatus().getStatus());
} catch (Exception e) {
......@@ -459,7 +460,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = chemicalParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("");
chemicalParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.CHANGED, chemicalParser.getServiceStatus().getStatus());
} catch (Exception e) {
......@@ -540,7 +541,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
chemicalParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
chemicalParser.setWebPageDownloader(mockDownloader);
try {
chemicalParser.getChemicals(parkinsonDiseaseId, idsList);
......
......@@ -6,6 +6,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
......@@ -547,7 +548,7 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = drugBankHTMLParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
drugBankHTMLParser.setWebPageDownloader(mockDownloader);
drugBankHTMLParser.refreshCacheQuery("http://google.pl/");
fail("Exception expected");
......@@ -566,7 +567,7 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
GeneralCacheInterface cache = drugBankHTMLParser.getCache();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
drugBankHTMLParser.setWebPageDownloader(mockDownloader);
drugBankHTMLParser.setCache(null);
......@@ -659,7 +660,7 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = drugBankHTMLParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
drugBankHTMLParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.DOWN, drugBankHTMLParser.getServiceStatus().getStatus());
} catch (Exception e) {
......@@ -675,7 +676,7 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = drugBankHTMLParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("");
drugBankHTMLParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.CHANGED, drugBankHTMLParser.getServiceStatus().getStatus());
} catch (Exception e) {
......
......@@ -6,6 +6,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
......@@ -172,7 +173,7 @@ public class MeSHParserTest extends AnnotationTestFunctions {
MiriamData meshID = new MiriamData(MiriamType.MESH_2012, "D004298");
MeSHParser parserUnderTest = new MeSHParser();
WebPageDownloader webPageDownloader = Mockito.mock(WebPageDownloader.class);
when(webPageDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(webPageDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
parserUnderTest.setWebPageDownloader(webPageDownloader);
parserUnderTest.getMeSH(meshID);
......@@ -280,7 +281,7 @@ public class MeSHParserTest extends AnnotationTestFunctions {
try {
meshParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
meshParser.setWebPageDownloader(mockDownloader);
MiriamData meshID = new MiriamData(MiriamType.MESH_2012, "D010300");
......@@ -303,7 +304,7 @@ public class MeSHParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = meshParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
meshParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.DOWN, meshParser.getServiceStatus().getStatus());
} catch (Exception e) {
......@@ -319,7 +320,7 @@ public class MeSHParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = meshParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString()))
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
.thenThrow(new WrongResponseCodeIOException(null, HttpStatus.SC_NOT_FOUND));
meshParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.CHANGED, meshParser.getServiceStatus().getStatus());
......
......@@ -6,6 +6,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
......@@ -230,7 +231,7 @@ public class MiriamConnectorTest extends AnnotationTestFunctions {
try {
miriamConnector.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
miriamConnector.setWebPageDownloader(mockDownloader);
miriamConnector.getUrlString2(TaxonomyBackend.HUMAN_TAXONOMY);
......@@ -251,7 +252,7 @@ public class MiriamConnectorTest extends AnnotationTestFunctions {
WebPageDownloader downloader = miriamConnector.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
miriamConnector.setWebPageDownloader(mockDownloader);
miriamConnector.refreshCacheQuery("http://google.pl/");
fail("Exception expected");
......
......@@ -6,6 +6,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
......@@ -232,7 +233,7 @@ public class PubmedParserTest extends AnnotationTestFunctions {
try {
pubmedParser.setCache(null);
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
pubmedParser.setWebPageDownloader(mockDownloader);
String query = PubmedParser.PUBMED_PREFIX + PubmedParser.SERVICE_STATUS_PUBMED_ID;
......@@ -289,7 +290,7 @@ public class PubmedParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = pubmedParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
pubmedParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.DOWN, pubmedParser.getServiceStatus().getStatus());
} catch (Exception e) {
......@@ -305,7 +306,7 @@ public class PubmedParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = pubmedParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString()))
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
.thenReturn("<responseWrapper><version>" + PubmedParser.SUPPORTED_VERSION + "</version></responseWrapper>");
pubmedParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.DOWN, pubmedParser.getServiceStatus().getStatus());
......@@ -322,7 +323,7 @@ public class PubmedParserTest extends AnnotationTestFunctions {
WebPageDownloader downloader = pubmedParser.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString()))
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
.thenReturn("<responseWrapper><version>" + PubmedParser.SUPPORTED_VERSION + "blabla</version></responseWrapper>");
pubmedParser.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.CHANGED, pubmedParser.getServiceStatus().getStatus());
......@@ -350,7 +351,7 @@ public class PubmedParserTest extends AnnotationTestFunctions {
pubmedParser.setCache(null);
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("unknown response");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("unknown response");
pubmedParser.setWebPageDownloader(mockDownloader);
pubmedParser.getApiVersion();
fail("Exception expected");
......@@ -370,7 +371,7 @@ public class PubmedParserTest extends AnnotationTestFunctions {
pubmedParser.setCache(null);
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("<xml/>");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("<xml/>");
pubmedParser.setWebPageDownloader(mockDownloader);
assertNull(pubmedParser.getApiVersion());
} catch (Exception e) {
......@@ -388,7 +389,7 @@ public class PubmedParserTest extends AnnotationTestFunctions {
pubmedParser.setCache(null);
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
pubmedParser.setWebPageDownloader(mockDownloader);
pubmedParser.getApiVersion();
fail("Exception expected");
......
......@@ -5,6 +5,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
......@@ -104,7 +105,7 @@ public class TaxonomyBackendTest extends AnnotationTestFunctions {
WebPageDownloader downloader = taxonomyBackend.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
taxonomyBackend.setWebPageDownloader(mockDownloader);
taxonomyBackend.setCache(null);
taxonomyBackend.getNameForTaxonomy(new MiriamData(MiriamType.TAXONOMY, "9606"));
......@@ -248,7 +249,7 @@ public class TaxonomyBackendTest extends AnnotationTestFunctions {
WebPageDownloader downloader = taxonomyBackend.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
taxonomyBackend.setWebPageDownloader(mockDownloader);
taxonomyBackend.setCache(null);
......@@ -279,7 +280,7 @@ public class TaxonomyBackendTest extends AnnotationTestFunctions {
WebPageDownloader downloader = taxonomyBackend.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
taxonomyBackend.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.DOWN, taxonomyBackend.getServiceStatus().getStatus());
} catch (Exception e) {
......@@ -295,7 +296,7 @@ public class TaxonomyBackendTest extends AnnotationTestFunctions {
WebPageDownloader downloader = taxonomyBackend.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenReturn("");
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("");
taxonomyBackend.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.CHANGED, taxonomyBackend.getServiceStatus().getStatus());
} catch (Exception e) {
......@@ -311,7 +312,7 @@ public class TaxonomyBackendTest extends AnnotationTestFunctions {
WebPageDownloader downloader = taxonomyBackend.getWebPageDownloader();
try {
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString()))
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
.thenReturn("<em>Taxonomy ID: </em>1234");
taxonomyBackend.setWebPageDownloader(mockDownloader);
assertEquals(ExternalServiceStatusType.CHANGED, taxonomyBackend.getServiceStatus().getStatus());
......
......@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.nullable;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
......@@ -163,7 +164,7 @@ public class BrendaAnnotatorTest extends AnnotationTestFunctions {
protein.addMiriamData(new MiriamData(MiriamType.UNIPROT, "bla"));
WebPageDownloader mockDownloader = Mockito.mock(WebPageDownloader.class);
when(mockDownloader.getFromNetwork(anyString(), anyString(), anyString())).thenThrow(new IOException());
when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenThrow(new IOException());
uniprotAnnotator.setWebPageDownloader(mockDownloader);
brendaAnnotator.annotateElement(protein);
......
......@@ -5,8 +5,9 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyString;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
import static org.mockito.ArgumentMatchers.nullable;
import java.io.IOException;
......@@ -256,7 +257,7 @@ public class CazyAnnotatorTest extends AnnotationTestFunctions {