Author: tmortagne Date: 2008-02-18 14:55:53 +0100 (Mon, 18 Feb 2008) New Revision: 7792
Modified: xwiki-products/xwiki-enterprise/trunk/distribution-test/ldap-tests/src/test/it/com/xpn/xwiki/it/XWikiLDAPUtilsTest.java Log: XWIKI-1079: fixed some unit tests codestyle and javadoc. Modified: xwiki-products/xwiki-enterprise/trunk/distribution-test/ldap-tests/src/test/it/com/xpn/xwiki/it/XWikiLDAPUtilsTest.java =================================================================== --- xwiki-products/xwiki-enterprise/trunk/distribution-test/ldap-tests/src/test/it/com/xpn/xwiki/it/XWikiLDAPUtilsTest.java 2008-02-18 12:14:31 UTC (rev 7791) +++ xwiki-products/xwiki-enterprise/trunk/distribution-test/ldap-tests/src/test/it/com/xpn/xwiki/it/XWikiLDAPUtilsTest.java 2008-02-18 13:55:53 UTC (rev 7792) @@ -93,7 +93,8 @@ } /** - * check that the cache is not created each time it's getted and correctly handle refresh time. + * check that the cache is not created each time it's retrieved and correctly handle refresh + * time. * * @throws XWikiException error when getting the cache. * @throws XWikiCacheNeedsRefreshException @@ -105,24 +106,25 @@ XWikiCache tmpCache = this.ldapUtils.getCache(GROUPCACHE_NAME, this.context); XWikiCache cache = this.ldapUtils.getCache(GROUPCACHE_NAME, this.context); - assertTrue("Cache is recreated", tmpCache == cache); + assertSame("Cache is recreated", tmpCache, cache); cache.putInCache("key", "value"); String value = (String) cache.getFromCache("key"); - assertEquals("Value getted from cache is wrong", "value", value); + assertEquals("Value retrieved from cache is wrong", "value", value); + // Wait at least 1 second because the refresh time is provided in seconds in [EMAIL PROTECTED] + // XWikiCache#getFromCache(String, int)}. Thread.sleep(1000); - value = null; try { value = (String) cache.getFromCache("key", 1); - } catch (XWikiCacheNeedsRefreshException e) { - + fail("Should have thrown " + XWikiCacheNeedsRefreshException.class + + " exception because object has been added to the cache more than 1 second ago."); + } catch (XWikiCacheNeedsRefreshException expected) { + // OK : means the retrieved value is "older" than 1 second. } - - assertNull("Object in cache is not cleaned", value); } /** _______________________________________________ notifications mailing list notifications@xwiki.org http://lists.xwiki.org/mailman/listinfo/notifications