Index: src/test/java/info/magnolia/license/LicenseManagerTest.java =================================================================== --- src/test/java/info/magnolia/license/LicenseManagerTest.java (revision 50977) +++ src/test/java/info/magnolia/license/LicenseManagerTest.java (working copy) @@ -132,6 +132,27 @@ assertEquals(LicenseConsts.MSG_WARN_EXPIRATION, status.getMessage()); } + public void testSameDayThanExpirationDateShouldBeValid() throws Exception { + // given + final String today = new SimpleDateFormat(LicenseConsts.EXPIRATION_DATE_FORMAT).format(new Date()); + final Properties props = new Properties(); + props.setProperty(LicenseConsts.LICENSE_EXPIRATION_PROPERTY, today); + + // when + final License license = new License(MODULE_NAME, MODULE_NAME, props); + final LicensedModule module = getMockModule(license); + final LicenseStatus status = lm.performCheck(license, MODULE_NAME, module); + + // then + assertEquals(true, status.isValid()); + assertEquals(LicenseStatus.STATUS_WARN, status.getStatus()); + assertEquals(LicenseConsts.MSG_WARN_EXPIRATION, status.getMessage()); + // make sure we're still on the same day, if day has changed by the end of this test, errr... fail miserably !? + // TODO - any bright idea to make this less brittle ? + assertEquals("day has changed since this day started so err, we can't really be sure this worked", + today, new SimpleDateFormat(LicenseConsts.EXPIRATION_DATE_FORMAT).format(new Date())); + } + public void testLicenseIsValid() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Properties props = new Properties();