Search in sources :

Example 1 with LineCollector

use of de.neemann.digital.testing.parser.LineCollector in project Digital by hneemann.

the class TestDataTest method testSetDataParseable.

public void testSetDataParseable() throws Exception {
    TestCaseDescription td = new TestCaseDescription(DATA1);
    LineCollector cl = new LineCollector(td.getLines());
    assertEquals(4, cl.getLines().size());
    assertEquals(DATA1, td.getDataString());
    // try to set a parsable string
    td.setDataString(DATA2);
    // TestData has changed!
    assertEquals(DATA2, td.getDataString());
}
Also used : LineCollector(de.neemann.digital.testing.parser.LineCollector)

Example 2 with LineCollector

use of de.neemann.digital.testing.parser.LineCollector in project Digital by hneemann.

the class TestDataTest method testSetDataNonParseable.

public void testSetDataNonParseable() throws Exception {
    TestCaseDescription td = new TestCaseDescription(DATA1);
    LineCollector cl = new LineCollector(td.getLines());
    assertEquals(4, cl.getLines().size());
    assertEquals(DATA1, td.getDataString());
    // try to set a non parsable string
    try {
        td.setDataString(DATA3);
        assertTrue(false);
    } catch (IOException | ParserException e) {
        assertTrue(true);
    }
    // TestData remains unchanged!
    assertEquals(DATA1, td.getDataString());
}
Also used : ParserException(de.neemann.digital.testing.parser.ParserException) IOException(java.io.IOException) LineCollector(de.neemann.digital.testing.parser.LineCollector)

Aggregations

LineCollector (de.neemann.digital.testing.parser.LineCollector)2 ParserException (de.neemann.digital.testing.parser.ParserException)1 IOException (java.io.IOException)1