@@ -0,0 +1,3141 @@
+package uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.transformer.statistics;%0A%0Aimport uk.ac.ebi.quickgo.annotation.model.StatisticsValue;%0Aimport uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.model.BasicOntology;%0Aimport uk.ac.ebi.quickgo.rest.search.request.FilterRequest;%0Aimport uk.ac.ebi.quickgo.rest.search.request.converter.ConvertedFilter;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport org.hamcrest.core.Is;%0Aimport org.junit.Before;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Aimport static java.util.Collections.emptyList;%0Aimport static java.util.Collections.singletonList;%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.collection.IsMapContaining.hasEntry;%0Aimport static org.hamcrest.core.IsNot.not;%0Aimport static org.hamcrest.core.IsNull.nullValue;%0Aimport static uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.transformer.statistics.OntologyNameInjector.GO_ID;%0Aimport static uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.transformer.statistics.OntologyNameInjector%0A        .GO_NAME;%0A%0A/**%0A * @author Tony Wardell%0A * Date: 06/10/2017%0A * Time: 16:08%0A * Created with IntelliJ IDEA.%0A */%0Apublic class OntologyNameInjectorTest %7B%0A%0A    @Test%0A    @Ignore%0A    public void test()%7B%0A        assertThat(true, is(false));%0A    %7D%0A%0A    private OntologyNameInjector nameInjector;%0A%0A    @Before%0A    public void setUp() %7B%0A        nameInjector = new OntologyNameInjector();%0A    %7D%0A%0A    @Test%0A    public void injectorIdIsGoName() %7B%0A        assertThat(nameInjector.getId(), Is.is(GO_NAME));%0A    %7D%0A%0A    @Test%0A    public void responseValueIsInjectedToAnnotation() %7B%0A        BasicOntology mockedResponse = createBasicOntology();%0A        ConvertedFilter%3CBasicOntology%3E stubConvertedFilter = new ConvertedFilter%3C%3E(mockedResponse);%0A        String goId = %22go id in test%22;%0A        StatisticsValue statisticsValue = new StatisticsValue(goId, 5, 10L);%0A        assertThat(statisticsValue.getName(), Is.is(nullValue()));%0A%0A        nameInjector.injectValueFromResponse(stubConvertedFilter, statisticsValue);%0A%0A        assertThat(statisticsValue.getName(), Is.is(not(nullValue())));%0A        assertThat(statisticsValue.getName(), Is.is(mockedResponse.getResults().get(0).getName()));%0A    %7D%0A%0A    @Test%0A    public void correctFilterRequestIsBuilt() %7B%0A        String goId = %22go id in test%22;%0A        StatisticsValue statisticsValue = new StatisticsValue(goId, 5, 10L);%0A        FilterRequest filterRequest = nameInjector.buildFilterRequest(statisticsValue);%0A%0A        assertThat(filterRequest.getProperties(), hasEntry(nameInjector.getId(), emptyList()));%0A        assertThat(filterRequest.getProperties(), hasEntry(GO_ID, singletonList(goId)));%0A    %7D%0A%0A    private BasicOntology createBasicOntology() %7B%0A        BasicOntology ontology = new BasicOntology();%0A        List%3CBasicOntology.Result%3E results = new ArrayList%3C%3E();%0A        BasicOntology.Result result = new BasicOntology.Result();%0A        result.setId(%22ID:1%22);%0A        result.setName(%22Name:1%22);%0A        results.add(result);%0A        ontology.setResults(results);%0A        return ontology;%0A    %7D%0A%7D%0A

Test OntologyNameInjector.