### Question:
DefaultScreenManager implements ScreenManager<IScreen> { @Override public void addScreen(String name, IScreen screen) { if (name == null) { throw new NullPointerException(TAG_NAME_CANNOT_NULL); } if (name.isEmpty()) { throw new IllegalArgumentException(TAG_NAME_CANNOT_EMPTY); } if (screen == null) { throw new NullPointerException("screen cannot be null."); } if (this.screens.get(name) != null) { throw new IllegalStateException("screen '" + name + "' already exists!"); } screen.onStart(this); this.screens.put(name, screen); this.cachedScreenList.add(screen); Gdx.app.debug(TAG_SCREENS, "add screen: " + name); } DefaultScreenManager(); @Override void addScreen(String name, IScreen screen); @Override void removeScreen(String name); @Override void push(String name); @Override void leaveAllAndEnter(String name); @Override IScreen pop(); @Override IScreen getScreenByName(String name); @Override ObjectArrayList<IScreen> listScreens(); @Override ObjectArrayList<IScreen> listActiveScreens(); @Override void resize(int width, int height); @Override void update(); @Override void draw(); @Override void dispose();  }### Answer:
@Test public void testAddScreen () { DefaultScreenManager manager = this.createDefaultScreenManager(); assertEquals(0, manager.screens.size); assertEquals(0, manager.cachedScreenList.size()); assertEquals(0, manager.activeScreens.size()); manager.addScreen("dummy_screen", new DummyScreen()); assertEquals(1, manager.screens.size); assertEquals(1, manager.cachedScreenList.size()); assertEquals(0, manager.activeScreens.size()); assertEquals(1, manager.listScreens().size()); assertEquals(0, manager.listActiveScreens().size()); }
@Test public void testAddScreen1 () { ScreenManager<IScreen> manager = this.createScreenManager(); manager.addScreen("dummy_screen", new OtherDummyScreen()); }
@Test (expected = NullPointerException.class) public void testAddNullScreen () { ScreenManager<IScreen> manager = this.createScreenManager(); manager.addScreen(null, new DummyScreen()); }
@Test (expected = NullPointerException.class) public void testAddNullScreen1 () { ScreenManager<IScreen> manager = this.createScreenManager(); manager.addScreen("dummy_screen", null); }
@Test (expected = IllegalArgumentException.class) public void testAddEmptyScreen () { ScreenManager<IScreen> manager = this.createScreenManager(); manager.addScreen("", new DummyScreen()); }
@Test (expected = IllegalStateException.class) public void testAddExistentScreen () { ScreenManager<IScreen> manager = this.createScreenManager(); manager.addScreen("dummy_screen", new DummyScreen()); manager.addScreen("dummy_screen", new DummyScreen()); }