(no commit message)
[utils] / security / impl / src / test / java / org / wamblee / usermgt / InMemoryGroupSetTest.java
index a97adcca2bc41b86ba717b28d8bf1f8ca64313ea..49b631dffa943b8df24cbf86463d53d748c37629 100644 (file)
@@ -56,7 +56,7 @@ public class InMemoryGroupSetTest extends TestCase {
      *            Group to check for existence.
      * 
      */
-    protected void checkGroupExists(String aGroup) throws SQLException {
+    protected void checkGroupExists(String aGroup) throws Exception {
         // Empty
     }
 
@@ -67,7 +67,7 @@ public class InMemoryGroupSetTest extends TestCase {
      *            Group to check for non-existence.
      * 
      */
-    protected void checkGroupNotExists(String aGroup) throws SQLException {
+    protected void checkGroupNotExists(String aGroup) throws Exception {
         // Empty
     }
 
@@ -78,7 +78,7 @@ public class InMemoryGroupSetTest extends TestCase {
      *            Expected number of groups.
      * 
      */
-    protected void checkGroupCount(int aSize) throws SQLException {
+    protected void checkGroupCount(int aSize) throws Exception {
         assertEquals(aSize, groups.size());
     }
 
@@ -87,7 +87,7 @@ public class InMemoryGroupSetTest extends TestCase {
      * and contains().
      * 
      */
-    public void testAdd() throws SQLException {
+    public void testAdd() throws Exception {
         Group group = new Group("group1");
         assertTrue(groups.add(group));
         checkGroupExists(group.getName());
@@ -106,7 +106,7 @@ public class InMemoryGroupSetTest extends TestCase {
      * Tries to find a non-existing group. Verifies that null is returned.
      * 
      */
-    public void testFindUnknownGroup() throws SQLException {
+    public void testFindUnknownGroup() throws Exception {
         Group group1 = new Group("group1");
         Group group2 = new Group("group2");
         groups.add(group1);
@@ -122,7 +122,7 @@ public class InMemoryGroupSetTest extends TestCase {
      * Adds duplicate group. Verifies that the existing group is left untouched.
      * 
      */
-    public void testAddDuplicateGroup() throws SQLException {
+    public void testAddDuplicateGroup() throws Exception {
         Group group1 = new Group("group1");
         groups.add(group1);
 
@@ -141,7 +141,7 @@ public class InMemoryGroupSetTest extends TestCase {
      * is true.
      * 
      */
-    public void testRemoveGroup() throws SQLException {
+    public void testRemoveGroup() throws Exception {
         Group group1 = new Group("group1");
         groups.add(group1);
         assertTrue(groups.contains(group1));
@@ -159,14 +159,12 @@ public class InMemoryGroupSetTest extends TestCase {
      * the return value is true.
      * 
      */
-    public void testRemoveNonExistingGroup() throws SQLException {
+    public void testRemoveNonExistingGroup() throws Exception {
         Group group1 = new Group("group1");
         groups.add(group1);
         checkGroupCount(1);
 
         Group nonExistingGroup = new Group("group2");
-        nonExistingGroup.setPrimaryKey(new Long(1000));
-        nonExistingGroup.setPersistedVersion(1000);
         assertFalse(groups.remove(nonExistingGroup));
         assertTrue(groups.contains(group1));
         assertEquals(1, groups.list().size());
@@ -178,7 +176,7 @@ public class InMemoryGroupSetTest extends TestCase {
      * all.
      * 
      */
-    public void testList() throws SQLException {
+    public void testList() throws Exception {
         Group group1 = new Group("group1");
         Group group2 = new Group("group2");
         Group group3 = new Group("group3");
@@ -197,4 +195,15 @@ public class InMemoryGroupSetTest extends TestCase {
 
         checkGroupCount(3);
     }
+    
+    public void testRenameGroupTwice() { 
+        Group group = new Group("x"); 
+        groups.add(group); 
+        groups.groupModified(group);
+        group.setName("y");
+        groups.groupModified(group);
+        Group g = groups.find("y");
+        assertNotNull(g);
+        groups.groupModified(group);
+    }
 }