Adds additional addComponent tests.
@@ -345,7 +345,19 @@ public class ScreenTest {
}
@Test
- public void testAddComponent_withValidComponent() {
+ public void testAddComponent_withNullComponent() {
+ screen.addComponent(null);
+ Assert.assertEquals(0, screen.totalComponents());
+ }
+
+ @Test
+ public void testAddComponent_withSelf() {
+ screen.addComponent(screen);
+ Assert.assertEquals(0, screen.totalComponents());
+ }
+
+ @Test
+ public void testAddComponent_withLayer() {
final Layer otherComponent = new Layer(0, 0, 2, 2);
screen.addComponent(otherComponent);
@@ -353,15 +365,19 @@ public class ScreenTest {
}
@Test
- public void testAddComponent_withNullComponent() {
- screen.addComponent(null);
- Assert.assertEquals(0, screen.totalComponents());
+ public void testAddComponent_withScreen() {
+ final Screen otherComponent = new Screen(0, 0, 2, 2);
+ screen.addComponent(otherComponent);
+
+ Assert.assertTrue(screen.containsComponent(otherComponent));
}
@Test
- public void testAddComponent_withSelf() {
- screen.addComponent(screen);
- Assert.assertEquals(0, screen.totalComponents());
+ public void testAddComponent_withComponent() {
+ final Component otherComponent = new Component(0, 0, 2, 2);
+ screen.addComponent(otherComponent);
+
+ Assert.assertTrue(screen.containsComponent(otherComponent));
}
@Test
