Commit e75f511d authored by Matija Obreza's avatar Matija Obreza

Updated unit tests for "taxonomy" object

parent c12b604f
Pipeline #9594 passed with stage
in 21 seconds
......@@ -47,10 +47,6 @@ public class AccessionJson {
@JsonProperty(value = Accession.ACCENUMB_NEW)
private String newAcceNumb;
/** The genus. */
@JsonProperty(value = Accession.GENUS)
private String genus;
/** The uuid. */
@JsonProperty(value = Accession.UUID)
private String uuid;
......@@ -251,24 +247,6 @@ public class AccessionJson {
this.newAcceNumb = newAcceNumb;
}
/**
* Gets the genus.
*
* @return the genus
*/
public String getGenus() {
return genus;
}
/**
* Sets the genus.
*
* @param genus the new genus
*/
public void setGenus(final String genus) {
this.genus = genus;
}
/**
* Gets the uuid.
*
......
......@@ -155,7 +155,7 @@ public class AccessionApiTest {
final AccessionJson aj = new AccessionJson();
aj.setInstituteCode(instituteCode);
aj.setAccessionNumber("ACC-" + (i + 1));
aj.setGenus("Genus");
aj.getTaxonomy().setGenus("Genus");
ajList.add(aj);
}
......@@ -170,7 +170,7 @@ public class AccessionApiTest {
for (final AccessionJson aj1 : results) {
assertThat("Expected matching INSTCODE", aj1.getInstituteCode(), is(instituteCode));
assertThat("Expected ACCENUMB starting with", aj1.getAccessionNumber(), CoreMatchers.startsWith("ACC-"));
assertThat("Expected GENUS=Genus", aj1.getGenus(), is("Genus"));
assertThat("Expected GENUS=Genus", aj1.getTaxonomy().getGenus(), is("Genus"));
assertThat("Expected SPECIES=null", aj1.getTaxonomy().getSpecies(), nullValue());
}
......
......@@ -29,6 +29,7 @@ import org.genesys2.client.oauth.GenesysClient;
import org.genesys2.client.oauth.OAuthAuthenticationException;
import org.genesys2.client.oauth.PleaseRetryException;
import org.genesys2.client.oauth.api.accession.Api1Constants.Accession;
import org.genesys2.client.oauth.api.accession.Api1Constants.Taxonomy;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
......@@ -108,6 +109,6 @@ public class ApiTest {
final Collection<ObjectNode> list = new ArrayList<ObjectNode>();
list.add(objectMapper.createObjectNode().put(Accession.INSTCODE, "INS000").put(Accession.ACCENUMB, "ACC-1").put(Accession.GENUS, "Genus"));
list.add(objectMapper.createObjectNode().put(Accession.INSTCODE, "INS000").put(Accession.ACCENUMB, "ACC-1").putObject(Accession.TAXONOMY).put(Taxonomy.GENUS, "Genus"));
}
}
......@@ -217,7 +217,7 @@ public class MockGenesysServer {
return findMatch(accList, aj.getUuid());
} else {
for (final AccessionJson m : accList) {
if (m.getInstituteCode().equals(aj.getInstituteCode()) && m.getAccessionNumber().equals(aj.getAccessionNumber()) && m.getGenus().equals(aj.getGenus())) {
if (m.getInstituteCode().equals(aj.getInstituteCode()) && m.getAccessionNumber().equals(aj.getAccessionNumber()) && m.getTaxonomy().getGenus().equals(aj.getTaxonomy().getGenus())) {
return m;
}
}
......
......@@ -30,6 +30,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
import org.genesys2.client.oauth.api.accession.AccessionJson;
import org.genesys2.client.oauth.api.accession.Api1Constants.Accession;
import org.genesys2.client.oauth.api.accession.Api1Constants.Geo;
import org.genesys2.client.oauth.api.accession.Api1Constants.Taxonomy;
import org.genesys2.client.oauth.api.accession.GeoJson;
import org.junit.Test;
......@@ -59,7 +60,7 @@ public class ModelTests {
final AccessionJson aj = new AccessionJson();
aj.setInstituteCode("INS000");
aj.setAccessionNumber("ACC-1");
aj.setGenus("Genus");
aj.getTaxonomy().setGenus("Genus");
final JsonNode tree = getJsonTree(aj);
System.err.println(tree.toString());
......@@ -69,8 +70,8 @@ public class ModelTests {
assertThat("No ACCENUMB", tree.get(Accession.ACCENUMB), notNullValue());
assertThat("ACCENUMB must be a text node", tree.get(Accession.ACCENUMB), JsonNodeMatchers.isTextNode());
assertThat("Wrong ACCENUMB", tree.get(Accession.ACCENUMB).asText(), is("ACC-1"));
assertThat("No GENUS", tree.get(Accession.GENUS), notNullValue());
assertThat("Wrong GENUS", tree.get(Accession.GENUS).asText(), is("Genus"));
assertThat("No GENUS", tree.get(Accession.TAXONOMY).get(Taxonomy.GENUS), notNullValue());
assertThat("Wrong GENUS", tree.get(Accession.TAXONOMY).get(Taxonomy.GENUS).asText(), is("Genus"));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment