### Question:
TaskSchedulerFactory { public static TaskScheduler getTaskScheduler(String name) { if (name == null || "".equals(name)) { throw new SynapseTaskException("Name cannot be found."); } TaskScheduler taskScheduler = MAP.get(name); if (taskScheduler == null) { taskScheduler = new TaskScheduler(name); MAP.put(name, taskScheduler); } return taskScheduler; } private  TaskSchedulerFactory(); static TaskScheduler getTaskScheduler(String name);  }### Answer:
@Test public void testGetTaskScheduler() throws Exception { final String name = "new"; TaskScheduler taskSchedulerNew = TaskSchedulerFactory.getTaskScheduler(name); Assert.assertNotNull("Task Object null", taskSchedulerNew); TaskScheduler taskSchedulerExisting = TaskSchedulerFactory.getTaskScheduler(name); Assert.assertEquals("Can not get existing Task", taskSchedulerNew, taskSchedulerExisting); }
@Test(expected = SynapseTaskException.class) public void testGetTaskSchedulerForEmptyName() throws Exception { TaskSchedulerFactory.getTaskScheduler(""); }
@Test(expected = SynapseTaskException.class) public void testGetTaskSchedulerNameNull() throws Exception { TaskSchedulerFactory.getTaskScheduler(null); }