From 2c6a62d8b952ca3898c29f083c591ebff5b461ec Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Sun, 22 Sep 2024 10:14:42 +0200 Subject: [PATCH] Restructured and added a mapping test --- org.bridgedb.webservice.bridgerest/pom.xml | 6 +++++ .../webservice/bridgerest/BridgeRestTest.java | 22 +++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/org.bridgedb.webservice.bridgerest/pom.xml b/org.bridgedb.webservice.bridgerest/pom.xml index c38429fa5..8da58452a 100644 --- a/org.bridgedb.webservice.bridgerest/pom.xml +++ b/org.bridgedb.webservice.bridgerest/pom.xml @@ -80,6 +80,12 @@ ${project.parent.version} compile + + org.bridgedb + org.bridgedb.bio + ${project.parent.version} + test + org.junit.platform junit-platform-surefire-provider diff --git a/org.bridgedb.webservice.bridgerest/src/test/java/org/bridgedb/webservice/bridgerest/BridgeRestTest.java b/org.bridgedb.webservice.bridgerest/src/test/java/org/bridgedb/webservice/bridgerest/BridgeRestTest.java index 610b00f88..645f2e75d 100644 --- a/org.bridgedb.webservice.bridgerest/src/test/java/org/bridgedb/webservice/bridgerest/BridgeRestTest.java +++ b/org.bridgedb.webservice.bridgerest/src/test/java/org/bridgedb/webservice/bridgerest/BridgeRestTest.java @@ -14,22 +14,36 @@ // package org.bridgedb.webservice.bridgerest; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertNotNull; +import java.util.Set; + +import org.bridgedb.DataSource; import org.bridgedb.IDMapperException; +import org.bridgedb.Xref; +import org.bridgedb.bio.DataSourceTxt; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; public class BridgeRestTest { + private static BridgeRest service; + @BeforeAll - public static void init() { - + public static void init() throws IDMapperException { + if (DataSource.getDataSources().size() == 0) DataSourceTxt.init(); + BridgeRestTest.service = new BridgeRest("https://webservice.bridgedb.org/Human"); + assertNotNull(service); + assertTrue(service.isConnected()); } @Test - public void test() throws IDMapperException { - BridgeRest service = new BridgeRest("https://webservice.bridgedb.org/Human"); + public void testMap() throws IDMapperException { assertNotNull(service); + assertTrue(service.isConnected()); + Set mappings = service.mapID(new Xref("CHEBI:123", DataSource.getExistingBySystemCode("Ce"))); + assertNotSame(0, mappings.size()); } }