public void testSave() throws Exception
{
// Create a new group with random name
String name = "TestGroup" + String.valueOf( System.currentTimeMillis() );
Group group = new Group( name, m_wiki );
Principal al = new WikiPrincipal( "Al" );
Principal bob = new WikiPrincipal( "Bob" );
Principal cookie = new WikiPrincipal( "Cookie" );
group.add( al );
group.add( bob );
group.add( cookie );
m_db.save(group, new WikiPrincipal( "Tester" ) );
// Make sure the profile saved successfully
group = backendGroup( name );
assertEquals( name, group.getName() );
assertEquals( 3, group.members().length );
assertTrue( group.isMember( new WikiPrincipal( "Al" ) ) );
assertTrue( group.isMember( new WikiPrincipal( "Bob" ) ) );
assertTrue( group.isMember( new WikiPrincipal( "Cookie" ) ) );
// The back-end should have timestamped the create/modify fields
assertNotNull( group.getCreator() );
assertEquals( "Tester", group.getCreator() );
assertNotNull( group.getCreated() );