Commit f55a7953 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

some unit tests require additional information in input data

parent 059ab2f2
......@@ -14,7 +14,6 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection;
import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions;
......@@ -100,11 +99,12 @@ public class ReactionToXmlTest extends CellDesignerTestFunctions {
reaction.addModifier(modifier);
reaction.addModifier(modifier2);
reaction.addNode(andOperator);
reaction.setLine(new PolylineData(new Point2D.Double(1, 0), new Point2D.Double(12, 0)));
int warningCount = getWarnings().size();
toXmlParser.toXml(reaction);
assertEquals(2, getWarnings().size()- warningCount);
toXmlParser.toXml(reaction);
assertEquals(2, getWarnings().size() - warningCount);
}
......@@ -139,6 +139,7 @@ public class ReactionToXmlTest extends CellDesignerTestFunctions {
modifier.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double(30, 0)));
reaction.addModifier(modifier);
reaction.setLine(new PolylineData(new Point2D.Double(1, 0), new Point2D.Double(12, 0)));
String xml = toXmlParser.toXml(reaction);
......@@ -154,11 +155,10 @@ public class ReactionToXmlTest extends CellDesignerTestFunctions {
Complex complex = new Complex("4");
complex.setComplex(complex);
model.addElement(complex);
Species protein1 = new GenericProtein("2");
model.addElement(protein1);
Reaction reaction = new TransportReaction();
......
......@@ -105,13 +105,7 @@ public class ModifierTypeUtilsTest {
@Test
public void testGetAnchorPointOnReactionRectByInvalidType() {
try {
Reaction reaction = new Reaction();
Reactant reactant = new Reactant();
Product product = new Product();
reactant.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double()));
product.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double()));
reaction.addReactant(reactant);
reaction.addProduct(product);
Reaction reaction = createDummyReaction();
Point2D point = utils.getAnchorPointOnReactionRect(reaction, "0,0");
assertNotNull(point);
} catch (Exception e) {
......@@ -123,13 +117,7 @@ public class ModifierTypeUtilsTest {
@Test
public void testGetAnchorPointOnReactionRectByInvalidType2() {
try {
Reaction reaction = new Reaction();
Reactant reactant = new Reactant();
Product product = new Product();
reactant.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double()));
product.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double()));
reaction.addReactant(reactant);
reaction.addProduct(product);
Reaction reaction = createDummyReaction();
utils.getAnchorPointOnReactionRect(reaction, "0");
fail("Exception expected");
} catch (InvalidArgumentException e) {
......@@ -140,16 +128,22 @@ public class ModifierTypeUtilsTest {
}
}
private Reaction createDummyReaction() {
Reaction reaction = new Reaction();
Reactant reactant = new Reactant();
Product product = new Product();
reactant.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double()));
product.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double()));
reaction.addReactant(reactant);
reaction.addProduct(product);
reaction.setLine(new PolylineData(new Point2D.Double(1, 0), new Point2D.Double(12, 0)));
return reaction;
}
@Test
public void testGetAnchorPointOnReactionRectByInvalidType3() {
try {
Reaction reaction = new Reaction();
Reactant reactant = new Reactant();
Product product = new Product();
reactant.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double()));
product.setLine(new PolylineData(new Point2D.Double(), new Point2D.Double()));
reaction.addReactant(reactant);
reaction.addProduct(product);
Reaction reaction = createDummyReaction();
utils.getAnchorPointOnReactionRect(reaction, "10,10");
fail("Exception expected");
} catch (InvalidArgumentException e) {
......
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