test
This commit is contained in:
parent
9b286697c2
commit
e85333fd7f
|
@ -229,4 +229,12 @@ public class CommunityClient implements HasCache {
|
|||
|
||||
}
|
||||
|
||||
public String getCommunityApiUrl() {
|
||||
return communityApiUrl;
|
||||
}
|
||||
|
||||
public void setCommunityApiUrl(final String communityApiUrl) {
|
||||
this.communityApiUrl = communityApiUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package eu.dnetlib.app.directindex.clients;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import eu.dnetlib.app.directindex.clients.CommunityClient.ContextInfo;
|
||||
|
||||
@Disabled
|
||||
class CommunityClientTest {
|
||||
|
||||
// Class Under test
|
||||
private CommunityClient communityClient;
|
||||
|
||||
private static final String COMMUNITY_URL = "https://services.openaire.eu/openaire/community";
|
||||
|
||||
@BeforeEach
|
||||
public void initEach() {
|
||||
communityClient = new CommunityClient();
|
||||
communityClient.setCommunityApiUrl(COMMUNITY_URL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindContexts() {
|
||||
final Map<String, ContextInfo> ctx = communityClient.findContexts(Arrays.asList("sobigdata", "clarin::subcommunity::3", "clarin::subcommunity::4"));
|
||||
|
||||
assertEquals(5, ctx.size());
|
||||
|
||||
assertTrue(StringUtils.isNotBlank(ctx.get("clarin").getLabel()));
|
||||
assertTrue(StringUtils.isNotBlank(ctx.get("clarin").getType()));
|
||||
assertTrue(StringUtils.isNotBlank(ctx.get("clarin::subcommunity").getLabel()));
|
||||
assertTrue(StringUtils.isNotBlank(ctx.get("clarin::subcommunity::3").getLabel()));
|
||||
assertTrue(StringUtils.isNotBlank(ctx.get("clarin::subcommunity::4").getLabel()));
|
||||
|
||||
assertTrue(StringUtils.isNotBlank(ctx.get("sobigdata").getLabel()));
|
||||
assertTrue(StringUtils.isNotBlank(ctx.get("sobigdata").getType()));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue