Skip to content
Snippets Groups Projects
Commit 58d16875 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

unit tests fixed

parent 68acb510
No related branches found
No related tags found
1 merge request!1162Resolve "SBGN file with BOM cannot be converted to image by API converter"
Pipeline #27656 passed
......@@ -73,7 +73,7 @@ public class ConvertRestImplTest extends RestTestFunctions {
@Test
public void testCelDesigner2Sbml1() throws Exception {
String content = readFile("testFiles/convert/sample-cd.xml");
byte[] content = readFile("testFiles/convert/sample-cd.xml").getBytes();
String result = convertRestImpl.convert(
"lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser",
"lcsb.mapviewer.converter.model.sbml.SbmlParser", content);
......@@ -84,16 +84,16 @@ public class ConvertRestImplTest extends RestTestFunctions {
@Test
public void testCelDesigner2Svg() throws Exception {
String content = readFile("testFiles/convert/sample-cd.xml");
String result = convertRestImpl.converToImage("CellDesigner_SBML", "svg", content).toString();
String result = convertRestImpl.converToImage("CellDesigner_SBML", "svg", content.getBytes()).toString();
assertTrue(result.contains("<rect"));
}
@Test
public void testCellDesigner2Sbml2Svg() throws Exception {
String content = readFile("testFiles/convert/neuron_cd.xml");
byte[] content = readFile("testFiles/convert/neuron_cd.xml").getBytes();
String resultSbml = convertRestImpl.convert("CellDesigner_SBML", "SBML", content).toString();
String resultSvg = convertRestImpl.converToImage("SBML", "svg", resultSbml).toString();
String resultSvg = convertRestImpl.converToImage("SBML", "svg", resultSbml.getBytes()).toString();
assertTrue(resultSvg.contains("<rect"));
}
......@@ -101,10 +101,10 @@ public class ConvertRestImplTest extends RestTestFunctions {
@Test
public void testCellDesigner2Sbml2CellDesignerSvg() throws Exception {
String content = readFile("testFiles/convert/neuron_cd.xml");
String resultSbml = convertRestImpl.convert("CellDesigner_SBML", "SBML", content).toString();
String resultCellDesignerSbml = convertRestImpl.convert("SBML", "CellDesigner_SBML", resultSbml)
String resultSbml = convertRestImpl.convert("CellDesigner_SBML", "SBML", content.getBytes()).toString();
String resultCellDesignerSbml = convertRestImpl.convert("SBML", "CellDesigner_SBML", resultSbml.getBytes())
.toString();
String resultSvg = convertRestImpl.converToImage("CellDesigner_SBML", "svg", resultCellDesignerSbml)
String resultSvg = convertRestImpl.converToImage("CellDesigner_SBML", "svg", resultCellDesignerSbml.getBytes())
.toString();
assertTrue(resultSvg.contains("<rect"));
......@@ -113,8 +113,8 @@ public class ConvertRestImplTest extends RestTestFunctions {
@Test
public void testScaling() throws Exception {
String content = readFile("testFiles/convert/sample-cd.xml");
String result1 = convertRestImpl.converToImage("CellDesigner_SBML", "svg", content, 50.0, 50.0).toString();
String result2 = convertRestImpl.converToImage("CellDesigner_SBML", "svg", content, 100.0, 100.0)
String result1 = convertRestImpl.converToImage("CellDesigner_SBML", "svg", content.getBytes(), 50.0, 50.0).toString();
String result2 = convertRestImpl.converToImage("CellDesigner_SBML", "svg", content.getBytes(), 100.0, 100.0)
.toString();
Pattern pattern = Pattern.compile(".*scale\\(([0-9]+\\.[0-9]+),([0-9]+\\.[0-9]+)\\).*");
......@@ -131,8 +131,8 @@ public class ConvertRestImplTest extends RestTestFunctions {
public void test1() throws Exception {
String content = readFile("testFiles/convert/glycolysis2.xml");
String result = convertRestImpl.convert("CellDesigner_SBML", "SBML", content);
ByteArrayOutputStream result1 = convertRestImpl.converToImage("SBML", "svg", result);
String result = convertRestImpl.convert("CellDesigner_SBML", "SBML", content.getBytes());
ByteArrayOutputStream result1 = convertRestImpl.converToImage("SBML", "svg", result.getBytes());
File output = new File("testFiles/convert/glycolysis2.svg");
......@@ -147,8 +147,8 @@ public class ConvertRestImplTest extends RestTestFunctions {
public void test2() throws Exception {
String content = readFile("testFiles/convert/glycolysis2.xml");
String result = convertRestImpl.convert("CellDesigner_SBML", "SBML", content);
String result1 = convertRestImpl.convert("SBML", "CellDesigner_SBML", result);
String result = convertRestImpl.convert("CellDesigner_SBML", "SBML", content.getBytes());
String result1 = convertRestImpl.convert("SBML", "CellDesigner_SBML", result.getBytes());
assertNotNull(result);
assertNotNull(result1);
......@@ -157,7 +157,7 @@ public class ConvertRestImplTest extends RestTestFunctions {
@Test
public void testCelDesigner2Sbgn() throws Exception {
String content = readFile("testFiles/convert/sample-cd.xml");
String result = convertRestImpl.convert("CellDesigner_SBML", "SBGN-ML", content).toString();
String result = convertRestImpl.convert("CellDesigner_SBML", "SBGN-ML", content.getBytes()).toString();
assertTrue(result.contains("glyph class=\"complex\""));
}
......@@ -181,14 +181,14 @@ public class ConvertRestImplTest extends RestTestFunctions {
targets.addAll(extractIdsFromOutputs(info));
for (String target : targets) {
String result = convertRestImpl.convert(converter, target, content).toString();
String result = convertRestImpl.convert(converter, target, content.getBytes()).toString();
assertTrue(result.length() > 0);
}
targets.clear();
targets.addAll(extractIdsFromOutputs(infoImage));
for (String target : targets) {
String result = convertRestImpl.converToImage(converter, target, content).toString();
String result = convertRestImpl.converToImage(converter, target, content.getBytes()).toString();
assertTrue(result.length() > 0);
}
}
......
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