JAL-2349 JAL-3855 formatting
[jalview.git] / test / jalview / viewmodel / styles / ViewStyleTest.java
index bc74d8a..3019afa 100644 (file)
@@ -60,8 +60,8 @@ public class ViewStyleTest
    * @throws IllegalArgumentException
    */
   @Test(groups = { "Functional" })
-  public void testCopyConstructor() throws IllegalArgumentException,
-          IllegalAccessException
+  public void testCopyConstructor()
+          throws IllegalArgumentException, IllegalAccessException
   {
     ViewStyle vs1 = new ViewStyle();
     Field[] fields = ViewStyle.class.getDeclaredFields();
@@ -83,7 +83,7 @@ public class ViewStyleTest
         final Object value1 = field1.get(vs1);
         final Object value2 = field1.get(vs2);
         String msg = "Mismatch in " + field1.getName() + "(" + value1 + "/"
-              + value2 + ") - not set in copy constructor?";
+                + value2 + ") - not set in copy constructor?";
         assertEquals(msg, value1, value2);
       }
     }
@@ -91,8 +91,8 @@ public class ViewStyleTest
   }
 
   /**
-   * Add tests here for any fields that we expect to be ignored by 
-   * the copy constructor
+   * Add tests here for any fields that we expect to be ignored by the copy
+   * constructor
    * 
    * @param field
    * @return
@@ -100,14 +100,17 @@ public class ViewStyleTest
   private boolean copyConstructorIgnores(Field field)
   {
     /*
-     * just instrumentation added by test coverage while testing
+     * ignore instrumentation added by jacoco for test coverage
      */
-    String type = field.getClass().toString();
-    if (type.toString().contains("com_atlassian_clover"))
+    if (field.isSynthetic())
+    {
+      return true;
+    }
+    if (field.getType().toString().contains("com_atlassian_clover"))
     {
-      // instrumentation added for test coverage - ignore
       return true;
     }
+
     return false;
   }
 
@@ -171,8 +174,8 @@ public class ViewStyleTest
     }
     else if (type.equals(Color.class))
     {
-      field.set(vs, Color.RED.equals(field.get(vs)) ? Color.BLACK
-              : Color.RED);
+      field.set(vs,
+              Color.RED.equals(field.get(vs)) ? Color.BLACK : Color.RED);
     }
     else
     {
@@ -205,8 +208,8 @@ public class ViewStyleTest
    * @throws IllegalArgumentException
    */
   @Test(groups = { "Functional" })
-  public void testEquals() throws IllegalArgumentException,
-          IllegalAccessException
+  public void testEquals()
+          throws IllegalArgumentException, IllegalAccessException
   {
     ViewStyle vs1 = new ViewStyle();
     ViewStyle vs2 = new ViewStyle(vs1);
@@ -225,7 +228,7 @@ public class ViewStyleTest
         Object oldValue = field.get(vs2);
         changeValue(vs2, field);
         assertFalse("equals method ignores " + field.getName(),
-              vs1.equals(vs2));
+                vs1.equals(vs2));
 
         if (vs1.hashCode() == vs2.hashCode())
         {