mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
A couple of minor fixes.
Fix method signature to refer to the precise exception thrown. Use Instant from Java 8 rather than DateUtils.truncate.
This commit is contained in:
@@ -37,6 +37,7 @@ import static org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanServic
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_RM_SITE;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -46,7 +47,9 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -173,4 +176,25 @@ public class RecordsManagementAuditServiceImplUnitTest
|
||||
// Check that the event of viewing the audit log was itself audited.
|
||||
verify(mockAuditComponent).recordAuditValues(eq(RM_AUDIT_PATH_ROOT), any(Map.class));
|
||||
}
|
||||
|
||||
/** Check that passing null to getStartOfDay doesn't result in null being returned. */
|
||||
@Test
|
||||
public void testGetStartOfDay_null()
|
||||
{
|
||||
Date startOfDay = recordsManagementAuditServiceImpl.getStartOfDay(null);
|
||||
assertNotNull("Expected date to be created by method.", startOfDay);
|
||||
}
|
||||
|
||||
/** Check that any time component passed to getStartOfDay is not included in the response. */
|
||||
@Test
|
||||
public void testGetStartOfDay_timeDiscarded() throws Exception
|
||||
{
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
|
||||
Date date = format.parse("2001-02-03 04:05:06.789");
|
||||
|
||||
// Call the method under test.
|
||||
Date startOfDay = recordsManagementAuditServiceImpl.getStartOfDay(date);
|
||||
|
||||
assertEquals("Unexpected date truncation.", format.parse("2001-02-03 00:00:00.000"), startOfDay);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user