@Test public void testDiscoverRunnableMission() throws NoSuchMethodException { List<Method> actualMethods = runnableMole.discover(TestDefinitions.RunnableMission.class); List<Method> expectedMethods = new ArrayList<>(); expectedMethods.add(TestDefinitions.RunnableMission.class.getMethod("run")); assertEquals(expectedMethods, actualMethods); }
@Test public void testRunWithNonExistentMissionContentClassType() { expectedException.expect(MissionExecutionException.class); expectedException.expectCause(isA(ClassNotFoundException.class)); runnableMole.run("NonExistent"); }
@Test public void testRunWithNullMissionContentClassType() { expectedException.expect(MissionExecutionException.class); expectedException.expectCause(isA(IllegalArgumentException.class)); runnableMole.run(null); }
@Test public void testRunWithNonRunnableMission() { expectedException.expect(MissionExecutionException.class); expectedException.expectCause(isA(IllegalArgumentException.class)); runnableMole.run(TestDefinitions.EmptyMission.class.getName()); }
@Test public void testRunRunnableMission() { runnableMole.run(TestDefinitions.RunnableMission.class.getName()); }
@Test public void testDiscoverRunnableMissionWithNullClassType() { expectedException.expect(IllegalArgumentException.class); runnableMole.discover(null); }
@Test public void testDiscoverNonRunnableMission() { List<Method> actualMethods = runnableMole.discover(TestDefinitions.EmptyMission.class); assertTrue(actualMethods.isEmpty()); }