public void testResave() throws Exception
{
// Create a new group with random name & 3 members
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() );
// Modify the members by adding the group; re-add Al while we're at it
Principal dave = new WikiPrincipal( "Dave" );
group.add( al );
group.add( dave );
m_db.save(group, new WikiPrincipal( "SecondTester" ) );
// We should see 4 members and new timestamp info
Principal[] members = group.members();
assertEquals( 4, members.length );
assertNotNull( group.getCreator() );