### Question:
ModalApplication extends SimpleApplication implements Application { public E getMode() { return mode; } protected  ModalApplication(
            Class<E> modeClass,
            E defaultMode,
            String[] args); E getMode();  }### Answer:
@Test public void uses_default_mode_when_none_found() { TestModes mode = new TestModalApplication(ARGS_MISSING).getMode(); assertThat(mode, equalTo(TestModes.PROD)); }
@Test public void can_read_mode_from_args() { TestModes shouldBeDEV = new TestModalApplication(ARGS_DEV).getMode(); assertThat(shouldBeDEV, equalTo(TestModes.DEV)); TestModes shouldBePROD = new TestModalApplication(ARGS_PROD).getMode(); assertThat(shouldBePROD, equalTo(TestModes.PROD)); }
@Test(expected = UnknownModeException.class) public void throws_error_when_unknown_mode() { new TestModalApplication(ARGS_NOT_VALID).getMode(); }
@Test(expected = UnknownModeException.class) public void modes_are_case_sensitive() { new TestModalApplication(ARGS_BAD_CASE).getMode(); }