package org.ovirt.engine.core.utils;

import java.util.Arrays;
import java.util.List;

import junit.framework.TestCase;

public class ObjectIdentityCheckerTest extends TestCase {
    public void testIsUpdateable() {
        ObjectIdentityChecker oic = new ObjectIdentityChecker(Jedi.class);
        assertFalse("Should be false by default", oic.IsFieldUpdatable("name"));
        oic.AddPermittedFields("name");
        assertTrue("Should be true now", oic.IsFieldUpdatable("name"));
    }

    public void testNoChanges() {
        Jedi jedi1 = new Jedi();
        Jedi jedi2 = new Jedi();

        List<String> changes = ObjectIdentityChecker.GetChangedFields(jedi1, jedi2);
        assertTrue("Should be no changes", changes.size() == 0);
    }

    public void testChanges() {
        Jedi jedi1 = new Jedi();
        Jedi jedi2 = new Jedi();
        jedi2.saberColor = "red"; // Gone to the dark side

        List<String> changes = ObjectIdentityChecker.GetChangedFields(jedi1, jedi2);
        assertTrue("Should be 1 changes", changes.size() == 1);
    }

    public void testIsFieldsUpdated() {
        Jedi jedi1 = new Jedi();
        Jedi jedi2 = new Jedi();
        jedi2.saberColor = "red"; // Gone to the dark side
        ObjectIdentityChecker oic = new ObjectIdentityChecker(Jedi.class);

        boolean changed = oic.IsFieldsUpdated(jedi1, jedi2, Arrays.asList("name"));
        assertFalse("No Change", changed);
        changed = oic.IsFieldsUpdated(jedi1, jedi2, Arrays.asList("saberColor"));
        assertTrue("1 Change", changed);
    }
}

@@ -31,16 +31,104 @@
 utils;%0A%0A
+import static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0A
 import j
@@ -179,32 +179,22 @@
 ort 
+org.
 junit.
-framework.TestCase
+Test
 ;%0A%0Ap
@@ -235,26 +235,19 @@
 est 
-extends TestCase %7B
+%7B%0A    @Test
 %0A   
@@ -547,32 +547,42 @@
 name%22));%0A    %7D%0A%0A
+    @Test%0A
     public void 
@@ -815,32 +815,42 @@
 ) == 0);%0A    %7D%0A%0A
+    @Test%0A
     public void 
@@ -1143,24 +1143,34 @@
  1);%0A    %7D%0A%0A
+    @Test%0A
     public v

Convert ObjectIdentityCheckerTest to JUnit4