software-testing/project_task_sheets/phase_05/project_phase05_tasks/DurationTest.java
2022-07-05 19:03:10 +02:00

46 lines
1.6 KiB
Java

import org.junit.Assert;
import org.junit.Test;
public class DurationTest {
@Test
public void testToStringCORMutation() {
// Killed 4,5
Assert.assertEquals("PT-0.999999999S",
new Duration(-1, 1).toString());
// Killed 1,3,4,6,7
Assert.assertEquals("PT-1S",
new Duration(-1, 0).toString());
// Killed 1,3,4,6,8
Assert.assertEquals("PT0.000000001S",
new Duration(0, 1).toString());
}
@Test
public void testToStringRORMutation() {
// Killed Mutation: Line 18: Unequal
Assert.assertEquals("PT0S",
new Duration(0, 0).toString());
// Killed Mutation: Line 26: Equals, Line 35.1: Equals
Assert.assertEquals("PT-1S",
new Duration(-1, 0).toString());
// Killed Mutation: Line 29: Less
Assert.assertEquals("PT1M",
new Duration(60, 0).toString());
// Killed Mutation: Line 32.1: FalseOp, Line 32.2: Greater
Assert.assertEquals("PT0.000000001S",
new Duration(0, 1).toString());
// Killed Mutation: Line 35.2: Less
Assert.assertEquals("PT1.000000001S",
new Duration(1, 1).toString());
// Killed Mutation: Line 36: LessEquals
Assert.assertEquals("PT-58.999999999S",
new Duration(-59, 1).toString());
// Killed Mutation: Line 46: GreaterEquals
Assert.assertEquals("PT-0.999999999S",
new Duration(-1, 1).toString());
// Killed Mutation: Line 51: Unequal
Assert.assertEquals("PT0.0000001S",
new Duration(0, 100).toString());
}
}