Search in sources :

Example 41 with AssertionFailedError

use of org.opentest4j.AssertionFailedError in project uniprot-store by ebi-uniprot.

the class GeneCentricJobIT method returnsCanonicalWithRelated.

private void returnsCanonicalWithRelated(GeneCentricDocumentConverter converter, List<GeneCentricDocument> savedDocuments) {
    GeneCentricDocument document = savedDocuments.stream().filter(doc -> doc.getAccession().equals("O51971")).findFirst().orElseThrow(AssertionFailedError::new);
    assertEquals("O51971", document.getAccession());
    assertNotNull(document.getGeneCentricStored());
    GeneCentricEntry entry = converter.getCanonicalEntryFromDocument(document);
    assertNotNull(entry.getCanonicalProtein());
    assertEquals("UP000000554", entry.getProteomeId());
    assertEquals("O51971", entry.getCanonicalProtein().getId());
    assertNotNull(entry.getRelatedProteins());
    assertEquals(1, entry.getRelatedProteins().size());
    Protein relatedProtein = entry.getRelatedProteins().get(0);
    assertEquals("Q9HI14", relatedProtein.getId());
}
Also used : GeneCentricEntry(org.uniprot.core.genecentric.GeneCentricEntry) AssertionFailedError(org.opentest4j.AssertionFailedError) GeneCentricDocument(org.uniprot.store.search.document.genecentric.GeneCentricDocument) Protein(org.uniprot.core.genecentric.Protein)

Example 42 with AssertionFailedError

use of org.opentest4j.AssertionFailedError in project uniprot-store by ebi-uniprot.

the class GeneCentricJobIT method returnsCanonicalWithoutRelated.

private void returnsCanonicalWithoutRelated(GeneCentricDocumentConverter converter, List<GeneCentricDocument> savedDocuments) {
    GeneCentricDocument document = savedDocuments.stream().filter(doc -> doc.getAccession().equals("A0A6G0ZDD9")).findFirst().orElseThrow(AssertionFailedError::new);
    assertEquals("A0A6G0ZDD9", document.getAccession());
    assertNotNull(document.getGeneCentricStored());
    GeneCentricEntry entry = converter.getCanonicalEntryFromDocument(document);
    assertNotNull(entry.getCanonicalProtein());
    assertEquals("UP000478052", entry.getProteomeId());
    assertEquals("A0A6G0ZDD9", entry.getCanonicalProtein().getId());
    assertNotNull(entry.getRelatedProteins());
    assertTrue(entry.getRelatedProteins().isEmpty());
}
Also used : GeneCentricEntry(org.uniprot.core.genecentric.GeneCentricEntry) AssertionFailedError(org.opentest4j.AssertionFailedError) GeneCentricDocument(org.uniprot.store.search.document.genecentric.GeneCentricDocument)

Example 43 with AssertionFailedError

use of org.opentest4j.AssertionFailedError in project uniprot-store by ebi-uniprot.

the class GeneCentricDocumentsToHDFSWriterTest method returnsCanonicalWithoutRelated.

private void returnsCanonicalWithoutRelated(GeneCentricDocumentConverter converter, List<GeneCentricDocument> savedDocuments) {
    GeneCentricDocument document = savedDocuments.stream().filter(doc -> doc.getAccession().equals("A0A6G0ZDD9")).findFirst().orElseThrow(AssertionFailedError::new);
    assertEquals("A0A6G0ZDD9", document.getAccession());
    assertNotNull(document.getGeneCentricStored());
    GeneCentricEntry entry = converter.getCanonicalEntryFromDocument(document);
    assertNotNull(entry.getCanonicalProtein());
    assertEquals("UP000478052", entry.getProteomeId());
    assertEquals("A0A6G0ZDD9", entry.getCanonicalProtein().getId());
    assertNotNull(entry.getRelatedProteins());
    assertTrue(entry.getRelatedProteins().isEmpty());
}
Also used : GeneCentricEntry(org.uniprot.core.genecentric.GeneCentricEntry) AssertionFailedError(org.opentest4j.AssertionFailedError) GeneCentricDocument(org.uniprot.store.search.document.genecentric.GeneCentricDocument)

Example 44 with AssertionFailedError

use of org.opentest4j.AssertionFailedError in project uniprot-store by ebi-uniprot.

the class SuggestDocumentsToHDFSWriterTest method getChebi.

@Test
void getChebi() {
    SuggestDocumentsToHDFSWriter writer = new SuggestDocumentsToHDFSWriter(parameter);
    JavaRDD<SuggestDocument> suggestRdd = writer.getChebi(flatFileRDD);
    assertNotNull(suggestRdd);
    long count = suggestRdd.count();
    assertEquals(30L, count);
    List<SuggestDocument> catalyticDocs = suggestRdd.filter(c -> c.dictionary.equals(CATALYTIC_ACTIVITY.name())).collect();
    assertEquals(10, catalyticDocs.size());
    assertNotNull(catalyticDocs);
    SuggestDocument document = catalyticDocs.stream().filter(c -> c.id.equals("CHEBI:23367")).findFirst().orElseThrow(AssertionFailedError::new);
    assertEquals(CATALYTIC_ACTIVITY.name(), document.dictionary);
    assertEquals("CHEBI:23367", document.id);
    assertEquals("molecular entity", document.value);
    assertEquals("medium", document.importance);
    assertEquals(5, document.altValues.size());
    assertTrue(document.altValues.contains("entidad molecular"));
    assertTrue(document.altValues.contains("entidades moleculares"));
    assertTrue(document.altValues.contains("entite moleculaire"));
    assertTrue(document.altValues.contains("molecular entities"));
    assertTrue(document.altValues.contains("molekulare Entitaet"));
    // Make sure we add relatedIds to suggest as well
    List<SuggestDocument> cofactorDocs = suggestRdd.filter(c -> c.dictionary.equals(COFACTOR.name())).collect();
    assertEquals(7, cofactorDocs.size());
    assertNotNull(cofactorDocs);
    document = cofactorDocs.stream().filter(c -> c.id.equals("CHEBI:2500")).findFirst().orElseThrow(AssertionFailedError::new);
    assertEquals(COFACTOR.name(), document.dictionary);
    assertEquals("CHEBI:2500", document.id);
    assertEquals("2500-fluoroethyl methanesulfonate", document.value);
    assertEquals("medium", document.importance);
    assertEquals(2, document.altValues.size());
    assertTrue(document.altValues.contains("2500-synonym"));
    assertTrue(document.altValues.contains("AABBBCCCDD-IIHHHHGGGFFFF-N"));
    List<SuggestDocument> chebiDocs = suggestRdd.filter(c -> c.dictionary.equals(CHEBI.name())).collect();
    assertNotNull(chebiDocs);
    document = chebiDocs.stream().filter(c -> c.id.equals("CHEBI:2500")).findFirst().orElseThrow(AssertionFailedError::new);
    assertEquals(CHEBI.name(), document.dictionary);
    assertEquals("CHEBI:2500", document.id);
    assertEquals("2500-fluoroethyl methanesulfonate", document.value);
    assertEquals("medium", document.importance);
    assertEquals(2, document.altValues.size());
    assertTrue(document.altValues.contains("2500-synonym"));
    assertTrue(document.altValues.contains("AABBBCCCDD-IIHHHHGGGFFFF-N"));
    assertEquals(13, chebiDocs.size());
    List<String> chebiIds = chebiDocs.stream().map(SuggestDocument::getDocumentId).collect(Collectors.toList());
    List<String> cofactorIds = cofactorDocs.stream().map(SuggestDocument::getDocumentId).collect(Collectors.toList());
    List<String> catalyticIds = catalyticDocs.stream().map(SuggestDocument::getDocumentId).collect(Collectors.toList());
    assertTrue(chebiIds.containsAll(cofactorIds));
    assertTrue(chebiIds.containsAll(catalyticIds));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Connection(java.sql.Connection) SuggestDocument(org.uniprot.store.search.document.suggest.SuggestDocument) JavaSparkContext(org.apache.spark.api.java.JavaSparkContext) Function(java.util.function.Function) AfterAll(org.junit.jupiter.api.AfterAll) SQLException(java.sql.SQLException) TestInstance(org.junit.jupiter.api.TestInstance) ResourceBundle(java.util.ResourceBundle) BeforeAll(org.junit.jupiter.api.BeforeAll) AssertionFailedError(org.opentest4j.AssertionFailedError) Map(java.util.Map) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) JavaRDD(org.apache.spark.api.java.JavaRDD) SparkUtils(org.uniprot.store.spark.indexer.common.util.SparkUtils) UniProtKBRDDTupleReader(org.uniprot.store.spark.indexer.uniprot.UniProtKBRDDTupleReader) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) TaxonomyH2Utils(org.uniprot.store.spark.indexer.taxonomy.reader.TaxonomyH2Utils) Test(org.junit.jupiter.api.Test) List(java.util.List) JobParameter(org.uniprot.store.spark.indexer.common.JobParameter) Assertions(org.junit.jupiter.api.Assertions) Statement(java.sql.Statement) SuggestDictionary(org.uniprot.store.search.document.suggest.SuggestDictionary) DriverManager(java.sql.DriverManager) SuggestDocument(org.uniprot.store.search.document.suggest.SuggestDocument) AssertionFailedError(org.opentest4j.AssertionFailedError) Test(org.junit.jupiter.api.Test)

Example 45 with AssertionFailedError

use of org.opentest4j.AssertionFailedError in project uniprot-store by ebi-uniprot.

the class ProteinsWithTest method validFeatureFromEnumDisplay.

@Test
void validFeatureFromEnumDisplay() {
    EnumDisplay enumDisplay = UniprotKBFeatureType.CARBOHYD;
    ProteinsWith proteinsWith = ProteinsWith.from(enumDisplay).orElseThrow(AssertionFailedError::new);
    assertEquals(26, proteinsWith.getValue());
    assertEquals(enumDisplay.getName(), proteinsWith.getEnumDisplay().getName());
}
Also used : EnumDisplay(org.uniprot.core.util.EnumDisplay) AssertionFailedError(org.opentest4j.AssertionFailedError) Test(org.junit.jupiter.api.Test)

Aggregations

AssertionFailedError (org.opentest4j.AssertionFailedError)140 Test (org.junit.jupiter.api.Test)69 AssertionTestUtils.expectAssertionFailedError (org.junit.jupiter.api.AssertionTestUtils.expectAssertionFailedError)12 AlertIntegrationTest (com.synopsys.integration.alert.util.AlertIntegrationTest)8 IOException (java.io.IOException)8 URI (java.net.URI)8 WithMockUser (org.springframework.security.test.context.support.WithMockUser)8 MockHttpServletRequestBuilder (org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder)8 SettingsProxyModel (com.synopsys.integration.alert.common.rest.model.SettingsProxyModel)4 Collectors (java.util.stream.Collectors)4 ThrowingCallable (org.assertj.core.api.ThrowableAssert.ThrowingCallable)4 GeneCentricEntry (org.uniprot.core.genecentric.GeneCentricEntry)4 GeneCentricDocument (org.uniprot.store.search.document.genecentric.GeneCentricDocument)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 Search (io.zulia.client.command.builder.Search)3 SearchResult (io.zulia.client.result.SearchResult)3 Assertions (org.junit.jupiter.api.Assertions)3 Order (org.junit.jupiter.api.Order)3 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2