### Question:
MonitorManager { protected AbstractMonitor createMonitor(final Type type) throws MonitorException { try { Class< ? extends AbstractMonitor> monitorClass = monitorClasses.get(type); if (monitorClass != null) { LOGGER.info("Creating a new monitor of type {}", type.name()); return monitorClass.newInstance(); } throw new MonitorException("There is no monitor defined of type: " + type.name()); } catch (Exception ex) { throw new MonitorException("There is no monitor defined of type: " + type.name(), ex); } } MonitorManager(); PhysicalMachine monitor(final String physicalMachineAddress, final Type type,
        final String username, final String password); void createAndStartMonitor(final String physicalMachineAddress, final Type type,
        final String username, final String password); void shutdown(final String physicalMachineAddress, final Type type); void stopAllMonitors(); VirtualMachine subscribe(final String physicalMachineAddress, final Type type,
        final String virtualMachineName); void unsubscribe(final String physicalMachineAddress, final Type type,
        final String virtualMachineName); void getState(final String physicalMachineAddress, final Type type,
        final String virtualMachineName); void invalidateLastKnownState(final String physicalMachineAddress, final Type type,
        final String virtualMachineName);  }### Answer:
@Test public void test_createMonitor() throws Exception { AbstractMonitor monitor1 = monitorManager.createMonitor(SingleMachineMonitor.TYPE); AbstractMonitor monitor2 = monitorManager.createMonitor(MulipleMachineMonitor.TYPE); AbstractMonitor monitor3 = monitorManager.createMonitor(InfiniteMachineMonitor.TYPE); assertNotNull(monitor1); assertNotNull(monitor2); assertNotNull(monitor3); assertEquals(monitor1.getClass(), SingleMachineMonitor.class); assertEquals(monitor2.getClass(), MulipleMachineMonitor.class); assertEquals(monitor3.getClass(), InfiniteMachineMonitor.class); }