Skip to content
Snippets Groups Projects
Commit 6a64180a authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Transitivity

Format
parent 98c05151
No related merge requests found
package koz01.java2.lab04;
import static koz01.java2.lab04.EquivalenceRoutines.assertReflexivity;
......@@ -18,59 +19,71 @@ class TestEquals {
@Test
@Order(1)
void testLogicEquality() {
Point p1 = new Point(1,2);
Point p2 = new Point(1,2);
Point p1 = new Point(1, 2);
Point p2 = new Point(1, 2);
assertTrue(p1.equals(p2));
Point p3 = new Point(1,1);
Point p3 = new Point(1, 1);
assertTrue(!p1.equals(p3));
Point cp1 = new ColorPoint(1,2,Color.BLACK);
Point cp2 = new ColorPoint(1,2,Color.BLACK);
Point cp1 = new ColorPoint(1, 2, Color.BLACK);
Point cp2 = new ColorPoint(1, 2, Color.BLACK);
assertTrue(cp1.equals(cp2));
Point cp3 = new ColorPoint(1,1,Color.BLACK);
Point cp3 = new ColorPoint(1, 1, Color.BLACK);
assertTrue(!cp1.equals(cp3));
Point cp4 = new ColorPoint(1,2,Color.WHITE);
Point cp4 = new ColorPoint(1, 2, Color.WHITE);
assertTrue(!cp1.equals(cp4));
}
@Test
@Order(2)
void testRelfexity() {
Point p1 = new Point(1,2);
Point p1 = new Point(1, 2);
assertReflexivity(p1);
}
@Test
@Order(3)
void testSymmetry() {
Point p1 = new Point(1,2);
Point p2 = new Point(1,2);
Point p3 = new ColorPoint(1,2, Color.AZURE);
Point p1 = new Point(1, 2);
Point p2 = new Point(1, 2);
assertSymmetry(p1, p2);
assertSymmetry(p2, p3);
Point p3 = new Point(1, 1);
assertSymmetry(p1, p3);
Point cp1 = new ColorPoint(1, 2, Color.BLACK);
Point cp2 = new ColorPoint(1, 2, Color.BLACK);
assertSymmetry(p1, cp2);
assertSymmetry(cp1, cp2);
Point cp3 = new ColorPoint(1, 1, Color.BLACK);
assertSymmetry(p1, cp3);
assertSymmetry(cp1, cp3);
Point cp4 = new ColorPoint(1, 2, Color.WHITE);
assertSymmetry(p1, cp4);
assertSymmetry(cp1, cp4);
}
@Test
@Order(4)
void testTransitivity() {
Point p1 = new ColorPoint(1,2,Color.CYAN);
Point p2 = new Point(1,2);
Point p3 = new ColorPoint(1,1, Color.AZURE);
assertFalse(p1.equals(p2));
assertFalse(p2.equals(p3));
assertFalse(p1.equals(p3));
Point p1 = new ColorPoint(1, 2, Color.WHITE);
Point p2 = new Point(1, 2);
Point p3 = new ColorPoint(1, 2, Color.BLACK);
EquivalenceRoutines.assertTransitivity(p1, p2, p3);
}
@Test
@Order(5)
void testLiskovPrinciple() {
Point p1 = new ColorPoint(1,2,Color.CYAN);
Point p2 = new ColorPoint(1,2, Color.CYAN) {
Point p1 = new ColorPoint(1, 2, Color.CYAN);
Point p2 = new ColorPoint(1, 2, Color.CYAN) {
@Override
public String toString() {
return "Moje barva";
......
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