Commit ef3fe92a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '262-chemicalService-NPE' into 'devel_11.0.x'

list of chemical sources doesn't contain null anymore

See merge request piotr.gawron/minerva!180
parents 7eec9884 85049dd8
......@@ -291,13 +291,17 @@ public class Chemical implements Serializable, TargettingStructure {
}
@Override
public Collection<MiriamData> getSources() {
List<MiriamData> sources = new ArrayList<>();
sources.add(getCasID());
sources.add(getChemicalId());
return sources;
}
@Override
public Collection<MiriamData> getSources() {
List<MiriamData> sources = new ArrayList<>();
if (getCasID() != null) {
sources.add(getCasID());
}
if (getChemicalId() != null) {
sources.add(getChemicalId());
}
return sources;
}
@Override
public Collection<Target> getTargets() {
......
......@@ -44,5 +44,4 @@ public abstract class DbSearchService {
}
}
}
......@@ -10,8 +10,9 @@ import lcsb.mapviewer.services.search.db.mirna.MiRNAServiceTest;
@RunWith(Suite.class)
@SuiteClasses({ AllSearchDrugTests.class, //
ChemicalServiceTest.class, //
MiRNAServiceTest.class, //
ChemicalServiceTest.class, //
DbSearchServiceTest.class, //
MiRNAServiceTest.class, //
})
public class AllSearchDbTests {
......
package lcsb.mapviewer.services.search.db;
import org.junit.Test;
import org.mockito.Mockito;
import lcsb.mapviewer.annotation.data.Chemical;
public class DbSearchServiceTest {
@Test
public void testCacheMiriamData() throws Exception {
Chemical chemical = new Chemical();
DbSearchService service = Mockito.mock(DbSearchService.class, Mockito.CALLS_REAL_METHODS);
service.cacheMiriamData(chemical);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment