### Question:
ChildrenManager { public synchronized boolean addChildDSR(String identifier) throws EmptyIdentifierFailureException, NullPointerFailureException { if (identifier == null) throw new NullPointerFailureException(); if (identifier.isEmpty()) throw new EmptyIdentifierFailureException(); boolean retval = false; if (childServices.containsKey(identifier)) { Date currentTime = new Date(); Date value = childServices.get(identifier); if ( value.getTime()+hour <= currentTime.getTime()) { retval = true; } childServices.remove(identifier); } else { retval = true; } childServices.put(identifier, new Date()); return retval; } ChildrenManager(); static synchronized ChildrenManager getInstance(); synchronized List<String> getChildDSRs(); synchronized boolean addChildDSR(String identifier); synchronized void childLiveCheck();  }### Answer:
@Test public void testAddChildDSR() { try { manager.addChildDSR(null); } catch (EmptyIdentifierFailureException e) { fail("Input was a NULL pointer and we catch EmptyIdentifierFailureException exception."); } catch (NullPointerFailureException e) { assertTrue("Detecting NullPointerFailureException exception.",true); } try { manager.addChildDSR(""); } catch (EmptyIdentifierFailureException e) { assertTrue("Detecting EmptyIdentifierFailureException exception.",true); } catch (NullPointerFailureException e) { fail("Child collection was emtpy and we catch NullPointerFailureException exception."); } try { manager.addChildDSR("test_child1"); manager.addChildDSR("test_child1"); } catch (EmptyIdentifierFailureException e) { fail("The input identifier is not empty but we catch EmptyIdentifierFailureException exception."); } catch (NullPointerFailureException e) { fail("The input identifier is not empty but we catch NullPointerFailureException exception."); } assertEquals("test_child1", manager.getChildDSRs().get(0)); try { manager.addChildDSR("test_child2"); manager.addChildDSR("test_child3"); } catch (EmptyIdentifierFailureException e) { fail("Every input identifier was not empty."); }catch (NullPointerFailureException e) { fail("Detecting NullPointerFailureException exception."); } List<String> childs = new ArrayList<String>(); childs.add("test_child1"); childs.add("test_child2"); childs.add("test_child3"); assertTrue(manager.getChildDSRs().containsAll(childs)); }