Commit 19aa8712 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Removed redundancy in tests

parent a68b6e17
/*
* Copyright (C) 2014 Lukas Jelonek <Lukas.Jelonek at computational.bio.uni-giessen.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Lukas Jelonek {@literal <Lukas.Jelonek at computational.bio.uni-giessen.de>}
*/
public class DbXRefResourceRegistryIT {
public DbXRefResourceRegistryIT() {
}
@Test
public void testSomeMethod() {
}
}
/*
* Copyright (C) 2014 Lukas Jelonek <ljelonek at cebitec.uni-bielefeld.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref.providers;
import de.cebitec.common.dbxref.api.DbXRef;
import de.cebitec.common.dbxref.api.Resource;
import de.cebitec.common.dbxref.persistence.SimpleDbXRef;
import de.cebitec.common.dbxref.spi.DbXRefResolver;
import java.util.ServiceLoader;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
*
* @author Lukas Jelonek {@literal <ljelonek at cebitec.uni-bielefeld.de>}
*/
public class ECProviderTest {
@Test
public void testIsProvidedService() {
ServiceLoader<DbXRefResolver> loader = ServiceLoader.load(DbXRefResolver.class);
boolean present = false;
for (DbXRefResolver dbXRefResolver : loader) {
if (dbXRefResolver instanceof ECProvider) {
present = true;
}
}
assertTrue(present);
}
@Test
public void testProvider() {
ECProvider provider = new ECProvider();
DbXRef validID = new SimpleDbXRef("EC", "1.1.1.1");
assertNotNull(provider.resolve(validID));
// mindestens eine resource
assertTrue(provider.resolve(validID).iterator().hasNext());
// sind die resources gueltig
Iterable<? extends Resource> resolve = provider.resolve(validID);
for (Resource resource : resolve) {
String resourceText = resource.getResourceText();
assertThat(resourceText, notNullValue());
assertFalse(resourceText.isEmpty());
}
}
}
/*
* Copyright (C) 2012 cb
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref.providers;
import de.cebitec.common.dbxref.api.DbXRef;
import de.cebitec.common.dbxref.spi.DbXRefResolver;
import de.cebitec.common.dbxref.api.Resource;
import de.cebitec.common.dbxref.persistence.SimpleDbXRef;
import java.util.ServiceLoader;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
/**
*
* @author cb
*/
public class GIProviderTest {
public GIProviderTest() {
}
@Test
public void testIsProvidedService() {
ServiceLoader<DbXRefResolver> loader = ServiceLoader.load(DbXRefResolver.class);
boolean present = false;
for (DbXRefResolver dbXRefResolver : loader) {
if (dbXRefResolver instanceof GIProvider) {
present = true;
}
}
assertTrue(present);
}
@Test
public void testProvider() {
GIProvider provider = new GIProvider();
DbXRef validGI = new SimpleDbXRef("GI", "731497");
assertNotNull(provider.resolve(validGI));
// mindestens eine resource
assertTrue(provider.resolve(validGI).iterator().hasNext());
// sind die resources gueltig
Iterable<? extends Resource> resolve = provider.resolve(validGI);
for (Resource resource : resolve) {
String resourceText = resource.getResourceText();
assertThat(resourceText, notNullValue());
assertFalse(resourceText.isEmpty());
}
}
}
/*
* Copyright (C) 2012 cb
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref.providers;
import de.cebitec.common.dbxref.api.DbXRef;
import de.cebitec.common.dbxref.spi.DbXRefResolver;
import de.cebitec.common.dbxref.api.Resource;
import de.cebitec.common.dbxref.persistence.SimpleDbXRef;
import java.util.ServiceLoader;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
/**
*
* @author cb
*/
public class GOProviderTest {
public GOProviderTest() {
}
@Test
public void testIsProvidedService() {
ServiceLoader<DbXRefResolver> loader = ServiceLoader.load(DbXRefResolver.class);
boolean present = false;
for (DbXRefResolver dbXRefResolver : loader) {
if (dbXRefResolver instanceof GOProvider) {
present = true;
}
}
assertTrue(present);
}
@Test
public void testProvider() {
GOProvider provider = new GOProvider();
DbXRef validID = new SimpleDbXRef("GO", "0097281");
assertNotNull(provider.resolve(validID));
// mindestens eine resource
assertTrue(provider.resolve(validID).iterator().hasNext());
// sind die resources gueltig
Iterable<? extends Resource> resolve = provider.resolve(validID);
for (Resource resource : resolve) {
String resourceText = resource.getResourceText();
assertThat(resourceText, notNullValue());
assertFalse(resourceText.isEmpty());
}
}
}
/*
* Copyright (C) 2012 cb
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref.providers;
import de.cebitec.common.dbxref.api.DbXRef;
import de.cebitec.common.dbxref.spi.DbXRefResolver;
import de.cebitec.common.dbxref.api.Resource;
import de.cebitec.common.dbxref.persistence.SimpleDbXRef;
import java.util.ServiceLoader;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
/**
*
* @author cb
*/
public class GeneIDProviderTest {
/**
* Test of resolve method, of class GeneIDProvider.
*/
@Test
public void testResolve_DbXRef() {
GeneIDProvider provider = new GeneIDProvider();
DbXRef validGI = new SimpleDbXRef("GendeID", "956582");
assertNotNull(provider.resolve(validGI));
// mindestens eine resource
assertTrue(provider.resolve(validGI).iterator().hasNext());
// sind die resources gueltig
Iterable<? extends Resource> resolve = provider.resolve(validGI);
for (Resource resource : resolve) {
String resourceText = resource.getResourceText();
assertThat(resourceText, notNullValue());
assertFalse(resourceText.isEmpty());
}
}
@Test
public void testIsProvidedService() {
ServiceLoader<DbXRefResolver> loader = ServiceLoader.load(DbXRefResolver.class);
boolean present = false;
for (DbXRefResolver dbXRefResolver : loader) {
if (dbXRefResolver instanceof GeneIDProvider) {
present = true;
}
}
assertTrue(present);
}
}
/*
* Copyright (C) 2013 aseidel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref.providers;
import de.cebitec.common.dbxref.api.DbXRef;
import de.cebitec.common.dbxref.api.Resource;
import de.cebitec.common.dbxref.persistence.SimpleDbXRef;
import de.cebitec.common.dbxref.spi.DbXRefResolver;
import java.util.ServiceLoader;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
*
* @author aseidel
*/
public class InterProProviderIT {
@Test
public void testIsProvidedService() {
ServiceLoader<DbXRefResolver> loader = ServiceLoader.load(DbXRefResolver.class);
boolean present = false;
for (DbXRefResolver dbXRefResolver : loader) {
if (dbXRefResolver instanceof InterProProvider) {
present = true;
}
}
assertTrue(present);
}
@Test
public void testProvider() {
InterProProvider provider = new InterProProvider();
DbXRef validGI = new SimpleDbXRef("InterPro", "IPR002928");
assertNotNull(provider.resolve(validGI));
// mindestens eine resource
assertTrue(provider.resolve(validGI).iterator().hasNext());
// sind die resources gueltig
Iterable<? extends Resource> resolve = provider.resolve(validGI);
for (Resource resource : resolve) {
String resourceText = resource.getResourceText();
assertThat(resourceText, notNullValue());
assertFalse(resourceText.isEmpty());
}
}
}
/*
* Copyright (C) 2012 cb
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref.providers;
import de.cebitec.common.dbxref.api.DbXRef;
import de.cebitec.common.dbxref.spi.DbXRefResolver;
import de.cebitec.common.dbxref.api.Resource;
import de.cebitec.common.dbxref.persistence.SimpleDbXRef;
import java.util.ServiceLoader;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
/**
*
* @author cb
*/
public class PDBProviderTest {
@Test
public void testIsProvidedService() {
ServiceLoader<DbXRefResolver> loader = ServiceLoader.load(DbXRefResolver.class);
boolean present = false;
for (DbXRefResolver dbXRefResolver : loader) {
if (dbXRefResolver instanceof PDBProvider) {
present = true;
}
}
assertTrue(present);
}
@Test
public void testProvider() {
PDBProvider provider = new PDBProvider();
DbXRef validID = new SimpleDbXRef("PDB", "4AJY");
assertNotNull(provider.resolve(validID));
// mindestens eine resource
assertTrue(provider.resolve(validID).iterator().hasNext());
// sind die resources gueltig
Iterable<? extends Resource> resolve = provider.resolve(validID);
int i = 0;
for (Resource resource : resolve) {
String resourceText = resource.getResourceText();
assertThat(resourceText, notNullValue());
assertFalse(resourceText.isEmpty());
//System.out.println("Resource "+i+":");
//System.out.println(resourceText);
i++;
}
//System.out.println("Summe: "+i);
// DbXRef invalidGI
}
}
/*
* Copyright (C) 2012 cb
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref.providers;
import de.cebitec.common.dbxref.api.DbXRef;
import de.cebitec.common.dbxref.spi.DbXRefResolver;
import de.cebitec.common.dbxref.api.Resource;
import de.cebitec.common.dbxref.persistence.SimpleDbXRef;
import java.util.ServiceLoader;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;
/**
*
* @author cb
*/
public class PFamProviderIT {
@Test
public void testIsProvidedService() {
ServiceLoader<DbXRefResolver> loader = ServiceLoader.load(DbXRefResolver.class);
boolean present = false;
for (DbXRefResolver dbXRefResolver : loader) {
if (dbXRefResolver instanceof PFamProvider) {
present = true;
}
}
assertTrue(present);
}
@Test
public void testProvider() {
PFamProvider provider = new PFamProvider();
DbXRef validID = new SimpleDbXRef("PFAM", "PF00002");
assertNotNull(provider.resolve(validID));
// mindestens eine resource
assertTrue(provider.resolve(validID).iterator().hasNext());
// sind die resources gueltig
Iterable<? extends Resource> resolve = provider.resolve(validID);
for (Resource resource : resolve) {
String resourceText = resource.getResourceText();
assertThat(resourceText, is(notNullValue()));
assertThat(resourceText, not(isEmptyString()));
}
}
}
/*
* Copyright (C) 2012 cb
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cebitec.common.dbxref.providers;
import de.cebitec.common.dbxref.DbXrefParser;
import de.cebitec.common.dbxref.api.DbXRef;
import de.cebitec.common.dbxref.spi.DbXRefResolver;
import de.cebitec.common.dbxref.api.Resource;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.ServiceLoader;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;
/**
*
* @author cb
*/
public class HttpProviderTest {
@Test
public void testIsProvidedService() {
ServiceLoader<DbXRefResolver> loader = ServiceLoader.load(DbXRefResolver.class);
boolean present = false;
for (DbXRefResolver dbXRefResolver : loader) {
if (dbXRefResolver instanceof HttpProvider) {
present = true;
}
}
assertTrue(present);
}
@Test
public void testProvider() {
HttpProvider provider = new HttpProvider();
DbXrefParser parser = new DbXrefParser();
List<DbXRef> asList = Arrays.asList(
parser.parse("http://www.google.de"),
parser.parse("https://www.google.de"));
for (DbXRef reference : asList) {
Collection<? extends Resource> resolve = provider.resolve(reference);
assertThat(resolve, notNullValue());
assertThat(resolve, not(empty()));
for (Resource resource : resolve) {
String resourceText = resource.getResourceText();
assertThat(resourceText, notNullValue());
assertFalse(resourceText.isEmpty());
}
}
}
}
/*
* Copyright (C) 2015 Lukas Jelonek <Lukas.Jelonek at computational.bio.uni-giessen.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*