when( assetItem.getStateDescription() ).thenReturn( "statedescription" ); when( assetItem.getCreator() ).thenReturn( "creator" ); when( assetItem.getCreatedDate() ).thenReturn( calendar ); when( assetItem.getLastContributor() ).thenReturn( "lastcontributor" ); when( assetItem.getLastModified() ).thenReturn( lastModifiedCalendar ); assetItem.getCreator() ); assertEquals( makeAssetPageRow.getCreatedDate(), assetItem.getCreatedDate().getTime() ); assertEquals( makeAssetPageRow.getLastContributor(), assetItem.getLastContributor() );
assertNotNull(ruleItem.getCreatedDate()); assertNotNull(linkedRuleItem.getCreatedDate()); assertTrue(now.before(ruleItem.getCreatedDate())); assertTrue(now.before(linkedRuleItem.getCreatedDate()));
@Test public void testAssetItemCreation() throws Exception { Calendar now = Calendar.getInstance(); Thread.sleep(500); //MN: need this sleep to get the correct date AssetItem ruleItem1 = getDefaultPackage().addAsset("testRuleItem", "test content"); assertNotNull(ruleItem1); assertNotNull(ruleItem1.getNode()); assertEquals("testRuleItem", ruleItem1.getName()); assertNotNull(ruleItem1.getCreatedDate()); assertTrue(now.before( ruleItem1.getCreatedDate() )); String packName = getDefaultPackage().getName(); assertEquals(packName, ruleItem1.getModuleName()); assertNotNull(ruleItem1.getUUID()); //try constructing with node of wrong type try { ModuleItem pitem = getRepo().loadDefaultModule(); new AssetItem(getRepo(), pitem.getNode()); fail("Exception not thrown for node of wrong type"); } catch(RulesRepositoryException e) { assertNotNull(e.getMessage()); } catch(Exception e) { fail("Caught unexpected exception: " + e); } }