From 648ead096ccc633bc16cf8b055f482e2e7125205 Mon Sep 17 00:00:00 2001 From: Ilkka Seppala Date: Fri, 8 May 2015 22:57:14 +0300 Subject: [PATCH] Unit test for Rectangle --- .../src/test/java/com/iluwatar/RectangleTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 double-dispatch/src/test/java/com/iluwatar/RectangleTest.java diff --git a/double-dispatch/src/test/java/com/iluwatar/RectangleTest.java b/double-dispatch/src/test/java/com/iluwatar/RectangleTest.java new file mode 100644 index 000000000..88d940220 --- /dev/null +++ b/double-dispatch/src/test/java/com/iluwatar/RectangleTest.java @@ -0,0 +1,15 @@ +package com.iluwatar; + +import org.junit.Assert; +import org.junit.Test; + +public class RectangleTest { + + @Test + public void test() { + Assert.assertTrue(new Rectangle(0,0,1,1).intersectsWith(new Rectangle(0,0,1,1))); + Assert.assertTrue(new Rectangle(0,0,1,1).intersectsWith(new Rectangle(-1,-5,7,8))); + Assert.assertFalse(new Rectangle(0,0,1,1).intersectsWith(new Rectangle(2,2,3,3))); + Assert.assertFalse(new Rectangle(0,0,1,1).intersectsWith(new Rectangle(-2,-2,-1,-1))); + } +}