### Question:
Properties { static Date lastModified(Resource resource) { if (resource != null) { return resource.getValueMap().get(NameConstants.PN_LAST_MOD, new Date()); } return new Date(); } private  Properties();   }### Answer:
@Test public void lastModified_null_returnNewDate() { final Date result = Properties.lastModified(null); assertNotNull(result); }
@Test public void lastModified_hasProperty_Date() { final Resource resource = mock(Resource.class); final ValueMap properties = mock(ValueMap.class); when(resource.getValueMap()).thenReturn(properties); final Date d = new Date(); when(properties.get(anyString(), any(Date.class))).thenReturn(d); final Date result = Properties.lastModified(resource); assertNotNull(result); assertEquals(result, d); }