Skip to content
Snippets Groups Projects
Commit 2c35221c authored by piotr.gawron's avatar piotr.gawron
Browse files

test coverage for model

parent 48e5bae3
No related branches found
No related tags found
1 merge request!1Issue 37
......@@ -23,7 +23,6 @@ import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.compartment.PathwayCompartment;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.species.Complex;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.Species;
......@@ -131,7 +130,7 @@ public class CreateHierarchyCommandTest extends CommandTestFunctions {
Model model = getModelForFile("testFiles/artifitial_compartments.xml", false);
new CreateHierarchyCommand(model, 2, 2).execute();
assertFalse(model.getElementByElementId("sa1").getCompartment() instanceof PathwayCompartment);
} catch (Exception e) {
e.printStackTrace();
......
......@@ -152,6 +152,26 @@ public class CompartmentTest {
}
}
@Test
public void testDoesntContainsIdenticalSpecies() throws Exception {
try {
Compartment compartment = new Compartment();
compartment.setName("AS");
Species species = new GenericProtein("idd");
species.setName("not identical name");
compartment.addElement(species);
assertFalse(compartment.containsIdenticalSpecies());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
private Model createCrossModel() {
Model model = new ModelFullIndexed(null);
model.addElement(new Compartment("default"));
......
......@@ -58,6 +58,7 @@ public class ReactionTest extends ModelTestFunctions {
Modifier modifier = new Catalysis(species);
reaction.addModifier(modifier);
assertTrue(reaction.containsElement(species));
assertFalse(reaction.containsElement(new GenericProtein("id")));
} catch (Exception e) {
e.printStackTrace();
throw e;
......
......@@ -10,9 +10,10 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import lcsb.mapviewer.ModelTestFunctions;
import lcsb.mapviewer.common.exception.NotImplementedException;
public class ComplexTest {
public class ComplexTest extends ModelTestFunctions {
@Before
public void setUp() throws Exception {
......@@ -107,6 +108,24 @@ public class ComplexTest {
}
}
@Test
public void testRemoveNonExistingElement() {
try {
Complex complex = new Complex();
Complex complex2 = new Complex();
Species protein = new GenericProtein("1");
protein.setComplex(complex2);
complex.removeElement(protein);
assertEquals(1, super.getWarnings().size());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testCopy() {
try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment