qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject [24/30] qpid-broker-j git commit: QPID-8151: [Broker-J] [Unit tests] Factor out QpidTestCase
Date Sun, 01 Apr 2018 20:26:31 GMT
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/AbstractConfiguredObjectTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/AbstractConfiguredObjectTest.java b/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/AbstractConfiguredObjectTest.java
index 47461b3..246329f 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/AbstractConfiguredObjectTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/AbstractConfiguredObjectTest.java
@@ -18,6 +18,11 @@
  */
 package org.apache.qpid.server.model.testmodels.singleton;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -28,13 +33,13 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
-import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.security.auth.Subject;
 
 import com.google.common.collect.Sets;
+import org.junit.Test;
 
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.AbstractConfigurationChangeListener;
@@ -45,16 +50,18 @@ import org.apache.qpid.server.model.SystemConfig;
 import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.store.ConfiguredObjectRecord;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.UnitTestBase;
+
 
 /**
  * Tests behaviour of AbstractConfiguredObject related to attributes including
  * persistence, defaulting, and attribute values derived from context variables.
  */
-public class AbstractConfiguredObjectTest extends QpidTestCase
+public class AbstractConfiguredObjectTest extends UnitTestBase
 {
     private final Model _model = TestModel.getInstance();
 
+    @Test
     public void testAttributePersistence()
     {
         final String objectName = "testNonPersistAttributes";
@@ -67,7 +74,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(objectName, object.getName());
         assertNull(object.getAutomatedNonPersistedValue());
         assertNull(object.getAutomatedPersistedValue());
-        assertEquals(TestSingletonImpl.DERIVED_VALUE, object.getDerivedValue());
+        assertEquals((long) TestSingletonImpl.DERIVED_VALUE, object.getDerivedValue());
 
         ConfiguredObjectRecord record = object.asObjectRecord();
 
@@ -95,9 +102,9 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
 
         assertFalse(record.getAttributes().containsKey(TestSingleton.AUTOMATED_NONPERSISTED_VALUE));
         assertFalse(record.getAttributes().containsKey(TestSingleton.DERIVED_VALUE));
-
     }
 
+    @Test
     public void testDefaultedAttributeValue()
     {
         final String objectName = "myName";
@@ -111,6 +118,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(TestSingleton.DEFAULTED_VALUE_DEFAULT, object1.getDefaultedValue());
     }
 
+    @Test
     public void testOverriddenDefaultedAttributeValue()
     {
         final String objectName = "myName";
@@ -124,9 +132,9 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
 
         assertEquals(objectName, object.getName());
         assertEquals("override", object.getDefaultedValue());
-
     }
 
+    @Test
     public void testOverriddenDefaultedAttributeValueRevertedToDefault()
     {
         final String objectName = "myName";
@@ -146,6 +154,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(TestSingleton.DEFAULTED_VALUE_DEFAULT, object.getDefaultedValue());
     }
 
+    @Test
     public void testDefaultInitialization()
     {
         TestSingleton object =
@@ -157,9 +166,10 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(object.getAttrWithDefaultFromContextMaterializeInit(), TestSingleton.testGlobalDefault);
 
         assertFalse(object.getActualAttributes().containsKey("attrWithDefaultFromContextNoInit"));
-        assertEquals("${"+TestSingleton.TEST_CONTEXT_DEFAULT+"}",object.getActualAttributes().get("attrWithDefaultFromContextCopyInit"));
-        assertEquals(TestSingleton.testGlobalDefault,object.getActualAttributes().get("attrWithDefaultFromContextMaterializeInit"));
-
+        assertEquals("${" + TestSingleton.TEST_CONTEXT_DEFAULT + "}",
+                            object.getActualAttributes().get("attrWithDefaultFromContextCopyInit"));
+        assertEquals(TestSingleton.testGlobalDefault,
+                            object.getActualAttributes().get("attrWithDefaultFromContextMaterializeInit"));
 
         Map<String, Object> attributes = new HashMap<>();
         attributes.put(ConfiguredObject.NAME, "testDefaultInitialization2");
@@ -171,9 +181,9 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals("foo", object.getAttrWithDefaultFromContextMaterializeInit());
 
         assertFalse(object.getActualAttributes().containsKey("attrWithDefaultFromContextNoInit"));
-        assertEquals("${"+TestSingleton.TEST_CONTEXT_DEFAULT+"}",object.getActualAttributes().get("attrWithDefaultFromContextCopyInit"));
-        assertEquals("foo",object.getActualAttributes().get("attrWithDefaultFromContextMaterializeInit"));
-
+        assertEquals("${" + TestSingleton.TEST_CONTEXT_DEFAULT + "}",
+                            object.getActualAttributes().get("attrWithDefaultFromContextCopyInit"));
+        assertEquals("foo", object.getActualAttributes().get("attrWithDefaultFromContextMaterializeInit"));
 
         setTestSystemProperty(TestSingleton.TEST_CONTEXT_DEFAULT, "bar");
         object = _model.getObjectFactory().create(TestSingleton.class,
@@ -185,11 +195,12 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals("bar", object.getAttrWithDefaultFromContextMaterializeInit());
 
         assertFalse(object.getActualAttributes().containsKey("attrWithDefaultFromContextNoInit"));
-        assertEquals("${"+TestSingleton.TEST_CONTEXT_DEFAULT+"}",object.getActualAttributes().get("attrWithDefaultFromContextCopyInit"));
-        assertEquals("bar",object.getActualAttributes().get("attrWithDefaultFromContextMaterializeInit"));
-
+        assertEquals("${" + TestSingleton.TEST_CONTEXT_DEFAULT + "}",
+                            object.getActualAttributes().get("attrWithDefaultFromContextCopyInit"));
+        assertEquals("bar", object.getActualAttributes().get("attrWithDefaultFromContextMaterializeInit"));
     }
 
+    @Test
     public void testEnumAttributeValueFromString()
     {
         final String objectName = "myName";
@@ -205,6 +216,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(TestEnum.TEST_ENUM1, object1.getEnumValue());
     }
 
+    @Test
     public void testEnumAttributeValueFromEnum()
     {
         final String objectName = "myName";
@@ -220,6 +232,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(TestEnum.TEST_ENUM1, object1.getEnumValue());
     }
 
+    @Test
     public void testIntegerAttributeValueFromString()
     {
         final String objectName = "myName";
@@ -232,9 +245,10 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                                                                     attributes, null);
 
         assertEquals(objectName, object1.getName());
-        assertEquals(-4, object1.getIntValue());
+        assertEquals((long) -4, (long) object1.getIntValue());
     }
 
+    @Test
     public void testIntegerAttributeValueFromInteger()
     {
         final String objectName = "myName";
@@ -247,9 +261,10 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                                                                     attributes, null);
 
         assertEquals(objectName, object1.getName());
-        assertEquals(5, object1.getIntValue());
+        assertEquals((long) 5, (long) object1.getIntValue());
     }
 
+    @Test
     public void testIntegerAttributeValueFromDouble()
     {
         final String objectName = "myName";
@@ -262,9 +277,10 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                                                                     attributes, null);
 
         assertEquals(objectName, object.getName());
-        assertEquals(6, object.getIntValue());
+        assertEquals((long) 6, (long) object.getIntValue());
     }
 
+    @Test
     public void testDateAttributeFromMillis()
     {
         final String objectName = "myName";
@@ -281,6 +297,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(new Date(now), object.getDateValue());
     }
 
+    @Test
     public void testDateAttributeFromIso8601()
     {
         final String objectName = "myName";
@@ -297,6 +314,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(new Date(0), object.getDateValue());
     }
 
+    @Test
     public void testStringAttributeValueFromContextVariableProvidedBySystemProperty()
     {
         String sysPropertyName = "testStringAttributeValueFromContextVariableProvidedBySystemProperty";
@@ -334,6 +352,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(contextToken, object3.getStringValue());
     }
 
+    @Test
     public void testMapAttributeValueFromContextVariableProvidedBySystemProperty()
     {
         String sysPropertyName = "testMapAttributeValueFromContextVariableProvidedBySystemProperty";
@@ -361,6 +380,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         System.clearProperty(sysPropertyName);
     }
 
+    @Test
     public void testStringAttributeValueFromContextVariableProvidedObjectsContext()
     {
         String contextToken = "${myReplacement}";
@@ -382,6 +402,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals("myValue", object1.getStringValue());
     }
 
+    @Test
     public void testInvalidIntegerAttributeValueFromContextVariable()
     {
         final Map<String, Object> attributes = new HashMap<>();
@@ -404,13 +425,13 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
             assertTrue("Message does not contain the attribute name", message.contains("intValue"));
             assertTrue("Message does not contain the non-interpolated value", message.contains("contextVal"));
             assertTrue("Message does not contain the interpolated value", message.contains("contextVal"));
-
         }
     }
 
+    @Test
     public void testCreateEnforcesAttributeValidValues() throws Exception
     {
-        final String objectName = getName();
+        final String objectName = getTestName();
         Map<String, Object> illegalCreateAttributes = new HashMap<>();
         illegalCreateAttributes.put(ConfiguredObject.NAME, objectName);
         illegalCreateAttributes.put(TestSingleton.VALID_VALUE, "illegal");
@@ -433,9 +454,10 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(TestSingleton.VALID_VALUE1, object.getValidValue());
     }
 
+    @Test
     public void testCreateEnforcesAttributeValidValuePattern() throws Exception
     {
-        final String objectName = getName();
+        final String objectName = getTestName();
         Map<String, Object> illegalCreateAttributes = new HashMap<>();
         illegalCreateAttributes.put(ConfiguredObject.NAME, objectName);
         illegalCreateAttributes.put(TestSingleton.VALUE_WITH_PATTERN, "illegal");
@@ -475,9 +497,10 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
     }
 
 
+    @Test
     public void testChangeEnforcesAttributeValidValues() throws Exception
     {
-        final String objectName = getName();
+        final String objectName = getTestName();
         Map<String, Object> legalCreateAttributes = new HashMap<>();
         legalCreateAttributes.put(ConfiguredObject.NAME, objectName);
         legalCreateAttributes.put(TestSingleton.VALID_VALUE, TestSingleton.VALID_VALUE1);
@@ -502,12 +525,12 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
 
         object.setAttributes(Collections.singletonMap(TestSingleton.VALID_VALUE, null));
         assertNull(object.getValidValue());
-
     }
 
+    @Test
     public void testCreateEnforcesAttributeValidValuesWithSets() throws Exception
     {
-        final String objectName = getName();
+        final String objectName = getTestName();
         final Map<String, Object> name = Collections.singletonMap(ConfiguredObject.NAME, (Object)objectName);
 
         Map<String, Object> illegalCreateAttributes = new HashMap<>(name);
@@ -544,9 +567,10 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
     }
 
 
+    @Test
     public void testChangeEnforcesAttributeValidValuePatterns() throws Exception
     {
-        final String objectName = getName();
+        final String objectName = getTestName();
         Map<String, Object> legalCreateAttributes = new HashMap<>();
         legalCreateAttributes.put(ConfiguredObject.NAME, objectName);
         legalCreateAttributes.put(TestSingleton.VALUE_WITH_PATTERN, "foozzzzzbar");
@@ -562,7 +586,6 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         object.setAttributes(Collections.singletonMap(TestSingleton.LIST_VALUE_WITH_PATTERN, Collections.singletonList("1.2.3.4")));
         assertEquals(Collections.singletonList("1.2.3.4"), object.getListValueWithPattern());
 
-
         try
         {
             object.setAttributes(Collections.singletonMap(TestSingleton.VALUE_WITH_PATTERN, "foobaz"));
@@ -587,7 +610,6 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals("foobar", object.getValueWithPattern());
         assertEquals(Collections.singletonList("1.2.3.4"), object.getListValueWithPattern());
 
-
         object.setAttributes(Collections.singletonMap(TestSingleton.VALUE_WITH_PATTERN, null));
         assertNull(object.getValueWithPattern());
 
@@ -596,9 +618,9 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
 
         object.setAttributes(Collections.singletonMap(TestSingleton.LIST_VALUE_WITH_PATTERN, null));
         assertNull(object.getListValueWithPattern());
-
     }
 
+    @Test
     public void testDefaultContextIsInContextKeys()
     {
         final String objectName = "myName";
@@ -609,18 +631,17 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         TestSingleton object = _model.getObjectFactory().create(TestSingleton.class,
                                                                     attributes, null);
 
-
         assertTrue("context default not in contextKeys",
-                   object.getContextKeys(true).contains(TestSingleton.TEST_CONTEXT_DEFAULT));
-        assertEquals("default",
-                     object.getContextValue(String.class, TestSingleton.TEST_CONTEXT_DEFAULT));
+                          object.getContextKeys(true).contains(TestSingleton.TEST_CONTEXT_DEFAULT));
+        assertEquals("default", object.getContextValue(String.class, TestSingleton.TEST_CONTEXT_DEFAULT));
 
         setTestSystemProperty(TestSingleton.TEST_CONTEXT_DEFAULT, "notdefault");
         assertTrue("context default not in contextKeys",
-                   object.getContextKeys(true).contains(TestSingleton.TEST_CONTEXT_DEFAULT));
+                          object.getContextKeys(true).contains(TestSingleton.TEST_CONTEXT_DEFAULT));
         assertEquals("notdefault", object.getContextValue(String.class, TestSingleton.TEST_CONTEXT_DEFAULT));
     }
 
+    @Test
     public void testDefaultContextVariableWhichRefersToThis()
     {
         final String objectName = "myName";
@@ -632,12 +653,14 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                                                                     attributes, null);
 
         assertTrue("context default not in contextKeys",
-                   object.getContextKeys(true).contains(TestSingleton.TEST_CONTEXT_DEFAULT_WITH_THISREF));
+                          object.getContextKeys(true).contains(TestSingleton.TEST_CONTEXT_DEFAULT_WITH_THISREF));
 
         String expected = "a context var that refers to an attribute " + objectName;
-        assertEquals(expected, object.getContextValue(String.class, TestSingleton.TEST_CONTEXT_DEFAULT_WITH_THISREF));
+        assertEquals(expected,
+                            object.getContextValue(String.class, TestSingleton.TEST_CONTEXT_DEFAULT_WITH_THISREF));
     }
 
+    @Test
     public void testDerivedAttributeValue()
     {
         final String objectName = "myName";
@@ -647,14 +670,15 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
 
         TestSingleton object = _model.getObjectFactory().create(TestSingleton.class,
                                                                     attributes, null);
-        assertEquals(TestSingletonImpl.DERIVED_VALUE, object.getDerivedValue());
+        assertEquals((long) TestSingletonImpl.DERIVED_VALUE, object.getDerivedValue());
 
         // Check that update is ignored
         object.setAttributes(Collections.singletonMap(TestSingleton.DERIVED_VALUE, System.currentTimeMillis()));
 
-        assertEquals(TestSingletonImpl.DERIVED_VALUE, object.getDerivedValue());
+        assertEquals((long) TestSingletonImpl.DERIVED_VALUE, object.getDerivedValue());
     }
 
+    @Test
     public void testSecureValueRetrieval()
     {
         final String objectName = "myName";
@@ -667,7 +691,8 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         final TestSingleton object = _model.getObjectFactory().create(TestSingleton.class,
                                                                     attributes, null);
 
-        assertEquals(AbstractConfiguredObject.SECURED_STRING_VALUE, object.getAttribute(TestSingleton.SECURE_VALUE));
+        assertEquals(AbstractConfiguredObject.SECURED_STRING_VALUE,
+                            object.getAttribute(TestSingleton.SECURE_VALUE));
         assertEquals(secret, object.getSecureValue());
 
         //verify we can retrieve the actual secure value using system rights
@@ -684,6 +709,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                      });
     }
 
+    @Test
     public void testImmutableAttribute()
     {
         final String originalValue = "myvalue";
@@ -697,7 +723,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
 
         assertEquals("Immutable value unexpectedly changed", originalValue, object.getImmutableValue());
 
-                     // Update to the same value is allowed
+        // Update to the same value is allowed
                      object.setAttributes(Collections.singletonMap(TestSingleton.IMMUTABLE_VALUE, originalValue));
 
         try
@@ -724,6 +750,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals("Immutable value unexpectedly changed", originalValue, object.getImmutableValue());
     }
 
+    @Test
     public void testImmutableAttributeNullValue()
     {
         Map<String, Object> attributes = new HashMap<>();
@@ -751,6 +778,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
     }
 
     /** Id and Type are key attributes in the model and are thus worthy of test of their own */
+    @Test
     public void testIdAndTypeAreImmutableAttribute()
     {
         Map<String, Object> attributes = new HashMap<>();
@@ -786,6 +814,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals(originalType, object.getType());
     }
 
+    @Test
     public void testSetAttributesFiresListener()
     {
         final String objectName = "listenerFiring";
@@ -816,31 +845,32 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         // Set updated value (should cause listener to fire)
         object.setAttributes(Collections.singletonMap(TestSingleton.STRING_VALUE, "second"));
 
-        assertEquals(1, listenerCount.get());
+        assertEquals((long) 1, (long) listenerCount.get());
         String delta = updates.remove(TestSingleton.STRING_VALUE);
         assertEquals("first=>second", delta);
 
         // Set unchanged value (should not cause listener to fire)
         object.setAttributes(Collections.singletonMap(TestSingleton.STRING_VALUE, "second"));
-        assertEquals(1, listenerCount.get());
+        assertEquals((long) 1, (long) listenerCount.get());
 
         // Set value to null (should cause listener to fire)
         object.setAttributes(Collections.singletonMap(TestSingleton.STRING_VALUE, null));
-        assertEquals(2, listenerCount.get());
+        assertEquals((long) 2, (long) listenerCount.get());
         delta = updates.remove(TestSingleton.STRING_VALUE);
         assertEquals("second=>null", delta);
 
         // Set to null again (should not cause listener to fire)
         object.setAttributes(Collections.singletonMap(TestSingleton.STRING_VALUE, null));
-        assertEquals(2, listenerCount.get());
+        assertEquals((long) 2, (long) listenerCount.get());
 
         // Set updated value (should cause listener to fire)
         object.setAttributes(Collections.singletonMap(TestSingleton.STRING_VALUE, "third"));
-        assertEquals(3, listenerCount.get());
+        assertEquals((long) 3, (long) listenerCount.get());
         delta = updates.remove(TestSingleton.STRING_VALUE);
         assertEquals("null=>third", delta);
     }
 
+    @Test
     public void testSetAttributesInterpolateValues()
     {
         setTestSystemProperty("foo1", "myValue1");
@@ -872,22 +902,23 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
 
         // Update the actual value ${foo1} => ${foo2}
         object.setAttributes(Collections.singletonMap(TestSingleton.STRING_VALUE, "${foo2}"));
-        assertEquals(1, listenerCount.get());
+        assertEquals((long) 1, (long) listenerCount.get());
 
         assertEquals("myValue2", object.getStringValue());
         assertEquals("${foo2}", object.getActualAttributes().get(TestSingleton.STRING_VALUE));
 
         // No change
         object.setAttributes(Collections.singletonMap(TestSingleton.STRING_VALUE, "${foo2}"));
-        assertEquals(1, listenerCount.get());
+        assertEquals((long) 1, (long) listenerCount.get());
 
         // Update the actual value ${foo2} => ${foo3} (which doesn't have a value)
         object.setAttributes(Collections.singletonMap(TestSingleton.STRING_VALUE, "${foo3}"));
-        assertEquals(2, listenerCount.get());
+        assertEquals((long) 2, (long) listenerCount.get());
         assertEquals("${foo3}", object.getStringValue());
         assertEquals("${foo3}", object.getActualAttributes().get(TestSingleton.STRING_VALUE));
     }
 
+    @Test
     public void testCreateAndLastUpdateDate() throws Exception
     {
         final String objectName = "myName";
@@ -906,9 +937,11 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         Thread.sleep(10);
         object.setAttributes(Collections.singletonMap(TestSingleton.DESCRIPTION, "desc"));
         assertEquals("Created time should not be updated by update", createdTime, object.getCreatedTime());
-        assertTrue("Last update time should be updated by update", object.getLastUpdatedTime().compareTo(createdTime) > 0);
+        assertTrue("Last update time should be updated by update",
+                          object.getLastUpdatedTime().compareTo(createdTime) > 0);
     }
 
+    @Test
     public void testStatistics() throws Exception
     {
         final String objectName = "myName";
@@ -920,10 +953,11 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                                                                     attributes, null);
 
         final Map<String, Object> stats = object.getStatistics();
-        assertEquals("Unexpected number of statistics", 1, stats.size());
+        assertEquals("Unexpected number of statistics", (long) 1, (long) stats.size());
         assertTrue("Expected statistic not found", stats.containsKey("longStatistic"));
     }
 
+    @Test
     public void testAuditInformation() throws Exception
     {
         final String creatingUser = "creatingUser";
@@ -949,7 +983,9 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                      });
 
         assertEquals("Unexpected creating user after object creation", creatingUser, object.getCreatedBy());
-        assertEquals("Unexpected last updating user after object creation", creatingUser, object.getLastUpdatedBy());
+        assertEquals("Unexpected last updating user after object creation",
+                            creatingUser,
+                            object.getLastUpdatedBy());
 
         final Date originalCreatedTime = object.getCreatedTime();
         final Date originalLastUpdatedTime = object.getLastUpdatedTime();
@@ -970,12 +1006,16 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                      });
 
         assertEquals("Creating user should not be changed by update", creatingUser, object.getCreatedBy());
-        assertEquals("Created time should not be changed by update", originalCreatedTime, object.getCreatedTime());
+        assertEquals("Created time should not be changed by update",
+                            originalCreatedTime,
+                            object.getCreatedTime());
 
         assertEquals("Last updated by should be changed by update", updatingUser, object.getLastUpdatedBy());
-        assertTrue("Last updated time by should be changed by update", originalLastUpdatedTime.before(object.getLastUpdatedTime()));
+        assertTrue("Last updated time by should be changed by update",
+                          originalLastUpdatedTime.before(object.getLastUpdatedTime()));
     }
 
+    @Test
     public void testAuditInformationIgnoresUserSuppliedAttributes() throws Exception
     {
         final String user = "user";
@@ -1002,7 +1042,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                                                       }
                                                   });
 
-        assertEquals("Unexpected creating user after object creation", user,  object.getCreatedBy());
+        assertEquals("Unexpected creating user after object creation", user, object.getCreatedBy());
         assertEquals("Unexpected last updating user after object creation", user, object.getLastUpdatedBy());
 
         final Date originalCreatedTime = object.getCreatedTime();
@@ -1032,13 +1072,17 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
                      });
 
         assertEquals("Creating user should not be changed by update", user, object.getCreatedBy());
-        assertEquals("Created time should not be changed by update", originalCreatedTime, object.getCreatedTime());
+        assertEquals("Created time should not be changed by update",
+                            originalCreatedTime,
+                            object.getCreatedTime());
 
         assertEquals("Last updated by should be changed by update", user, object.getLastUpdatedBy());
-        assertTrue("Last updated time by should be changed by update", originalLastUpdatedTime.before(object.getLastUpdatedTime()));
+        assertTrue("Last updated time by should be changed by update",
+                          originalLastUpdatedTime.before(object.getLastUpdatedTime()));
     }
 
 
+    @Test
     public void testAuditInformationPersistenceAndRecovery() throws Exception
     {
         final String creatingUser = "creatingUser";
@@ -1081,12 +1125,19 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         recovered.open();
 
         assertEquals("Unexpected recovered object created by", object.getCreatedBy(), recovered.getCreatedBy());
-        assertEquals("Unexpected recovered object created time", object.getCreatedTime(), recovered.getCreatedTime());
-
-        assertEquals("Unexpected recovered object updated by", object.getLastUpdatedBy(), recovered.getLastUpdatedBy());
-        assertEquals("Unexpected recovered object updated time", object.getLastUpdatedTime(), recovered.getLastUpdatedTime());
+        assertEquals("Unexpected recovered object created time",
+                            object.getCreatedTime(),
+                            recovered.getCreatedTime());
+
+        assertEquals("Unexpected recovered object updated by",
+                            object.getLastUpdatedBy(),
+                            recovered.getLastUpdatedBy());
+        assertEquals("Unexpected recovered object updated time",
+                            object.getLastUpdatedTime(),
+                            recovered.getLastUpdatedTime());
     }
 
+    @Test
     public void testPostSetAttributesReportsChanges()
     {
         final String objectName = "myName";
@@ -1099,19 +1150,21 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
 
         assertEquals(objectName, object.getName());
 
-
         object.setAttributes(Collections.emptyMap());
-        assertTrue("Unexpected member of update set for empty update", object.takeLastReportedSetAttributes().isEmpty());
+        assertTrue("Unexpected member of update set for empty update",
+                          object.takeLastReportedSetAttributes().isEmpty());
 
         Map<String, Object> update = new HashMap<>();
         update.put(TestSingleton.NAME, objectName);
         update.put(TestSingleton.DESCRIPTION, "an update");
 
         object.setAttributes(update);
-        assertEquals("Unexpected member of update set", Sets.newHashSet(TestSingleton.DESCRIPTION),
-                     object.takeLastReportedSetAttributes());
+        assertEquals("Unexpected member of update set",
+                            Sets.newHashSet(TestSingleton.DESCRIPTION),
+                            object.takeLastReportedSetAttributes());
     }
 
+    @Test
     public void testSetContextVariable()
     {
         final String objectName = "myName";
@@ -1135,6 +1188,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals("Unexpected previous value", contextVariableValue, previousValue);
     }
 
+    @Test
     public void testRemoveContextVariable()
     {
         final String objectName = "myName";
@@ -1154,7 +1208,9 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
         assertEquals("Unexpected context variable value", contextVariableValue, previousValue);
 
         context = object.getContext();
-        assertFalse("Context variable should not be present in context", context.containsKey(contextVariableName));
+        assertFalse("Context variable should not be present in context",
+                           context.containsKey(contextVariableName));
+
 
         previousValue = object.removeContextVariable(contextVariableName);
         assertNull("Previous value should be null", previousValue);

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/PreferencesTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/PreferencesTest.java b/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/PreferencesTest.java
index 3e99526..a45ec60 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/PreferencesTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/PreferencesTest.java
@@ -21,6 +21,10 @@
 package org.apache.qpid.server.model.testmodels.singleton;
 
 import static org.apache.qpid.server.model.preferences.PreferenceTestHelper.awaitPreferenceFuture;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 
 import java.security.PrivilegedAction;
@@ -37,6 +41,9 @@ import java.util.UUID;
 import javax.security.auth.Subject;
 
 import com.google.common.util.concurrent.ListenableFuture;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
@@ -48,9 +55,9 @@ import org.apache.qpid.server.model.preferences.PreferenceTestHelper;
 import org.apache.qpid.server.model.preferences.UserPreferencesImpl;
 import org.apache.qpid.server.security.auth.TestPrincipalUtils;
 import org.apache.qpid.server.store.preferences.PreferenceStore;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class PreferencesTest extends QpidTestCase
+public class PreferencesTest extends UnitTestBase
 {
     public static final String TEST_USERNAME = "testUser";
     private static final String TEST_PRINCIPAL_SERIALIZATION = TestPrincipalUtils.getTestPrincipalSerialization(TEST_USERNAME);
@@ -61,10 +68,9 @@ public class PreferencesTest extends QpidTestCase
     private Subject _testSubject;
     private TaskExecutor _preferenceTaskExecutor;
 
-    @Override
+    @Before
     public void setUp() throws Exception
     {
-        super.setUp();
         final String objectName = getTestName();
         _testObject = _model.getObjectFactory()
                             .create(TestSingleton.class,
@@ -79,13 +85,13 @@ public class PreferencesTest extends QpidTestCase
         _testSubject = TestPrincipalUtils.createTestSubject(TEST_USERNAME);
     }
 
-    @Override
+    @After
     public void tearDown() throws Exception
     {
         _preferenceTaskExecutor.stop();
-        super.tearDown();
     }
 
+    @Test
     public void testSimpleRoundTrip()
     {
         final Preference p = PreferenceFactory.fromAttributes(_testObject, PreferenceTestHelper.createPreferenceAttributes(
@@ -102,6 +108,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject, p);
     }
 
+    @Test
     public void testOverrideContradictingOwner()
     {
         Subject testSubject2 = TestPrincipalUtils.createTestSubject(TEST_USERNAME2);
@@ -121,6 +128,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject);
     }
 
+    @Test
     public void testGetOnlyOwnedPreferences()
     {
         final Preference testUserPreference =
@@ -154,6 +162,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject, testUserPreference);
     }
 
+    @Test
     public void testUpdate()
     {
         final Preference p1 = PreferenceFactory.fromAttributes(_testObject, PreferenceTestHelper.createPreferenceAttributes(
@@ -182,6 +191,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject, p2);
     }
 
+    @Test
     public void testProhibitTypeChange()
     {
         final Preference p1 = PreferenceFactory.fromAttributes(_testObject, PreferenceTestHelper.createPreferenceAttributes(
@@ -217,6 +227,7 @@ public class PreferencesTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testProhibitDuplicateNamesOfSameType()
     {
         final Preference p1 = PreferenceFactory.fromAttributes(_testObject, PreferenceTestHelper.createPreferenceAttributes(
@@ -252,6 +263,7 @@ public class PreferencesTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testProhibitDuplicateNamesOfSameTypeInSameUpdate()
     {
         final Preference p1 = PreferenceFactory.fromAttributes(_testObject, PreferenceTestHelper.createPreferenceAttributes(
@@ -284,6 +296,7 @@ public class PreferencesTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testProhibitPreferenceStealing() throws Exception
     {
         final String testGroupName = "testGroup";
@@ -310,7 +323,9 @@ public class PreferencesTest extends QpidTestCase
             {
                 final ListenableFuture<Set<Preference>> visiblePreferencesFuture = _testObject.getUserPreferences().getVisiblePreferences();
                 final Set<Preference> visiblePreferences = PreferenceTestHelper.awaitPreferenceFuture(visiblePreferencesFuture);
-                assertEquals("Unexpected number of visible preferences", 1, visiblePreferences.size());
+
+                assertEquals("Unexpected number of visible preferences", (long) 1, (long) visiblePreferences
+                        .size());
 
                 final Preference target = visiblePreferences.iterator().next();
                 Map<String, Object> replacementAttributes = new HashMap(target.getAttributes());
@@ -333,6 +348,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(user1Subject, originalPreference);
     }
 
+    @Test
     public void testProhibitDuplicateId() throws Exception
     {
         final String prefType = "X-testType";
@@ -427,6 +443,7 @@ public class PreferencesTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testReplace()
     {
         final String preferenceType = "X-testType";
@@ -480,6 +497,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(testSubject2, unaffectedPreference);
     }
 
+    @Test
     public void testDeleteAll() throws Exception
     {
         final Preference p1 = PreferenceFactory.fromAttributes(_testObject, PreferenceTestHelper.createPreferenceAttributes(
@@ -509,12 +527,13 @@ public class PreferencesTest extends QpidTestCase
             {
                 awaitPreferenceFuture(_testObject.getUserPreferences().delete(null, null, null));
                 Set<Preference> result = awaitPreferenceFuture(_testObject.getUserPreferences().getPreferences());
-                assertEquals("Unexpected number of preferences", 0, result.size());
+                assertEquals("Unexpected number of preferences", (long) 0, (long) result.size());
                 return null;
             }
         });
     }
 
+    @Test
     public void testDeleteByType() throws Exception
     {
         final String deleteType = "X-type-1";
@@ -553,6 +572,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject, unaffectedPreference);
     }
 
+    @Test
     public void testDeleteByTypeAndName() throws Exception
     {
         final String deleteType = "X-type-1";
@@ -602,6 +622,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject, unaffectedPreference1, unaffectedPreference2);
     }
 
+    @Test
     public void testDeleteById() throws Exception
     {
         final String deleteType = "X-type-1";
@@ -650,6 +671,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject, unaffectedPreference1, unaffectedPreference2);
     }
 
+    @Test
     public void testDeleteByTypeAndId() throws Exception
     {
         final String deleteType = "X-type-1";
@@ -698,6 +720,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject, unaffectedPreference1, unaffectedPreference2);
     }
 
+    @Test
     public void testDeleteByTypeAndNameAndId() throws Exception
     {
         final String deleteType = "X-type-1";
@@ -747,6 +770,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(_testSubject, unaffectedPreference1, unaffectedPreference2);
     }
 
+    @Test
     public void testDeleteByNameWithoutType() throws Exception
     {
         Subject.doAs(_testSubject, new PrivilegedAction<Void>()
@@ -768,6 +792,7 @@ public class PreferencesTest extends QpidTestCase
         });
     }
 
+    @Test
     public void testDeleteViaReplace()
     {
         final String preferenceType = "X-testType";
@@ -809,6 +834,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(testSubject2, unaffectedPreference);
     }
 
+    @Test
     public void testDeleteViaReplaceByType()
     {
         final String preferenceType = "X-testType";
@@ -861,6 +887,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(testSubject2, unaffectedPreference);
     }
 
+    @Test
     public void testDeleteViaReplaceByTypeAndName()
     {
         final String preferenceType = "X-testType";
@@ -914,6 +941,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(testSubject2, unaffectedPreference);
     }
 
+    @Test
     public void testReplaceByType()
     {
         final String replaceType = "X-replaceType";
@@ -975,6 +1003,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(testSubject2, unaffectedPreference);
     }
 
+    @Test
     public void testReplaceByTypeAndName()
     {
         final String replaceType = "X-replaceType";
@@ -1047,6 +1076,7 @@ public class PreferencesTest extends QpidTestCase
         assertPreferences(testSubject2, unaffectedPreference);
     }
 
+    @Test
     public void testGetVisiblePreferences()
     {
         final String testGroupName = "testGroup";
@@ -1095,7 +1125,7 @@ public class PreferencesTest extends QpidTestCase
             {
                 Set<Preference> retrievedPreferences =
                         awaitPreferenceFuture(_testObject.getUserPreferences().getVisiblePreferences());
-                assertEquals("Unexpected number of preferences", 2, retrievedPreferences.size());
+                assertEquals("Unexpected number of preferences", (long) 2, (long) retrievedPreferences.size());
 
                 Set<UUID> visibleIds = new HashSet<>(retrievedPreferences.size());
                 for (Preference preference : retrievedPreferences)
@@ -1110,6 +1140,7 @@ public class PreferencesTest extends QpidTestCase
         });
     }
 
+    @Test
     public void testGetVisiblePreferencesSharedByGroup()
     {
         final String testGroupName = "testGroup";
@@ -1148,16 +1179,17 @@ public class PreferencesTest extends QpidTestCase
             {
                 Set<Preference> retrievedPreferences =
                         awaitPreferenceFuture(_testObject.getUserPreferences().getVisiblePreferences());
-                assertEquals("Unexpected number of preferences", 2, retrievedPreferences.size());
+                assertEquals("Unexpected number of preferences", (long) 2, (long) retrievedPreferences.size());
                 assertTrue("Preference of my peer did not exist in visible set",
-                           retrievedPreferences.contains(sharedPreference));
+                                  retrievedPreferences.contains(sharedPreference));
                 assertTrue("My preference did not exist in visible set",
-                           retrievedPreferences.contains(testUserPreference));
+                                  retrievedPreferences.contains(testUserPreference));
                 return null;
             }
         });
     }
 
+    @Test
     public void testLastUpdatedDate() throws Exception
     {
         Date beforeUpdate = new Date();
@@ -1175,14 +1207,14 @@ public class PreferencesTest extends QpidTestCase
         Date afterUpdate = new Date();
         Date lastUpdatedDate = p1.getLastUpdatedDate();
         assertTrue(String.format("LastUpdated date is too early. Expected : after %s  Found : %s",
-                                 beforeUpdate,
-                                 lastUpdatedDate),
-                   beforeUpdate.before(lastUpdatedDate));
+                                        beforeUpdate,
+                                        lastUpdatedDate), beforeUpdate.before(lastUpdatedDate));
         assertTrue(String.format("LastUpdated date is too late. Expected : before %s  Found : %s", afterUpdate, lastUpdatedDate),
-                   afterUpdate.after(lastUpdatedDate));
+                          afterUpdate.after(lastUpdatedDate));
     }
 
 
+    @Test
     public void testCreatedDate() throws Exception
     {
         Date beforeCreation = new Date();
@@ -1200,13 +1232,13 @@ public class PreferencesTest extends QpidTestCase
         Date afterCreation = new Date();
         Date createdDate = p1.getCreatedDate();
         assertTrue(String.format("Creation date is too early. Expected : after %s  Found : %s",
-                                 beforeCreation,
-                                 createdDate),
-                   beforeCreation.before(createdDate));
+                                        beforeCreation,
+                                        createdDate), beforeCreation.before(createdDate));
         assertTrue(String.format("Creation date is too late. Expected : before %s  Found : %s", afterCreation, createdDate),
-                   afterCreation.after(createdDate));
+                          afterCreation.after(createdDate));
     }
 
+    @Test
     public void testLastUpdatedDateIsImmutable() throws Exception
     {
         final Preference p1 = PreferenceFactory.fromAttributes(_testObject, PreferenceTestHelper.createPreferenceAttributes(
@@ -1246,7 +1278,9 @@ public class PreferencesTest extends QpidTestCase
             {
                 Collection<Preference> retrievedPreferences =
                         awaitPreferenceFuture(_testObject.getUserPreferences().getPreferences());
-                assertEquals("Unexpected number of preferences", expectedPreferences.length, retrievedPreferences.size());
+                assertEquals("Unexpected number of preferences",
+                                    (long) expectedPreferences.length,
+                                    (long) retrievedPreferences.size());
                 Map<UUID, Preference> retrievedPreferencesMap = new HashMap<>(retrievedPreferences.size());
                 for (Preference retrievedPreference : retrievedPreferences)
                 {
@@ -1255,10 +1289,14 @@ public class PreferencesTest extends QpidTestCase
                 for (Preference expectedPreference : expectedPreferences)
                 {
                     Preference retrievedPreference = retrievedPreferencesMap.get(expectedPreference.getId());
-                    assertNotNull("Expected id '" + expectedPreference.getId() + "' not found", retrievedPreference);
+                    assertNotNull("Expected id '" + expectedPreference.getId() + "' not found",
+                                         retrievedPreference);
+
                     assertEquals("Unexpected name", expectedPreference.getName(), retrievedPreference.getName());
                     assertEquals("Unexpected type", expectedPreference.getType(), retrievedPreference.getType());
-                    assertEquals("Unexpected description", expectedPreference.getDescription(), retrievedPreference.getDescription());
+                    assertEquals("Unexpected description",
+                                        expectedPreference.getDescription(),
+                                        retrievedPreference.getDescription());
                 }
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-core/src/test/java/org/apache/qpid/server/plugin/AMQPProtocolVersionWrapperTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/plugin/AMQPProtocolVersionWrapperTest.java b/broker-core/src/test/java/org/apache/qpid/server/plugin/AMQPProtocolVersionWrapperTest.java
index c493391..9172fe6 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/plugin/AMQPProtocolVersionWrapperTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/plugin/AMQPProtocolVersionWrapperTest.java
@@ -20,39 +20,46 @@
  */
 package org.apache.qpid.server.plugin;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
 import org.apache.qpid.server.model.Protocol;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class AMQPProtocolVersionWrapperTest extends QpidTestCase
+public class AMQPProtocolVersionWrapperTest extends UnitTestBase
 {
+    @Test
     public void testAMQPProtocolVersionWrapper() throws Exception
     {
         final AMQPProtocolVersionWrapper wrapper0_8 = new AMQPProtocolVersionWrapper(Protocol.AMQP_0_8);
-        assertEquals(0 ,wrapper0_8.getMajor());
-        assertEquals(8 ,wrapper0_8.getMinor());
-        assertEquals(0 ,wrapper0_8.getPatch());
+        assertEquals((long) 0, (long) wrapper0_8.getMajor());
+        assertEquals((long) 8, (long) wrapper0_8.getMinor());
+        assertEquals((long) 0, (long) wrapper0_8.getPatch());
 
         final AMQPProtocolVersionWrapper wrapper0_9 = new AMQPProtocolVersionWrapper(Protocol.AMQP_0_9);
-        assertEquals(0 ,wrapper0_9.getMajor());
-        assertEquals(9 ,wrapper0_9.getMinor());
-        assertEquals(0 ,wrapper0_9.getPatch());
+        assertEquals((long) 0, (long) wrapper0_9.getMajor());
+        assertEquals((long) 9, (long) wrapper0_9.getMinor());
+        assertEquals((long) 0, (long) wrapper0_9.getPatch());
 
         final AMQPProtocolVersionWrapper wrapper0_9_1 = new AMQPProtocolVersionWrapper(Protocol.AMQP_0_9_1);
-        assertEquals(0 ,wrapper0_9_1.getMajor());
-        assertEquals(9 ,wrapper0_9_1.getMinor());
-        assertEquals(1 ,wrapper0_9_1.getPatch());
+        assertEquals((long) 0, (long) wrapper0_9_1.getMajor());
+        assertEquals((long) 9, (long) wrapper0_9_1.getMinor());
+        assertEquals((long) 1, (long) wrapper0_9_1.getPatch());
 
         final AMQPProtocolVersionWrapper wrapper0_10 = new AMQPProtocolVersionWrapper(Protocol.AMQP_0_10);
-        assertEquals(0 ,wrapper0_10.getMajor());
-        assertEquals(10 ,wrapper0_10.getMinor());
-        assertEquals(0 ,wrapper0_10.getPatch());
+        assertEquals((long) 0, (long) wrapper0_10.getMajor());
+        assertEquals((long) 10, (long) wrapper0_10.getMinor());
+        assertEquals((long) 0, (long) wrapper0_10.getPatch());
 
         final AMQPProtocolVersionWrapper wrapper1_0 = new AMQPProtocolVersionWrapper(Protocol.AMQP_1_0);
-        assertEquals(1 ,wrapper1_0.getMajor());
-        assertEquals(0 ,wrapper1_0.getMinor());
-        assertEquals(0 ,wrapper1_0.getPatch());
+        assertEquals((long) 1, (long) wrapper1_0.getMajor());
+        assertEquals((long) 0, (long) wrapper1_0.getMinor());
+        assertEquals((long) 0, (long) wrapper1_0.getPatch());
     }
 
+    @Test
     public void testAMQPProtocolVersionWrapperGetProtocol() throws Exception
     {
         for (final Protocol protocol : Protocol.values())
@@ -64,6 +71,7 @@ public class AMQPProtocolVersionWrapperTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testWrappingNonAMQPProtocol() throws Exception
     {
         try

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-core/src/test/java/org/apache/qpid/server/plugin/ProtocolEngineCreatorComparatorTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/plugin/ProtocolEngineCreatorComparatorTest.java b/broker-core/src/test/java/org/apache/qpid/server/plugin/ProtocolEngineCreatorComparatorTest.java
index bee3905..c990d26 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/plugin/ProtocolEngineCreatorComparatorTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/plugin/ProtocolEngineCreatorComparatorTest.java
@@ -20,12 +20,17 @@
  */
 package org.apache.qpid.server.plugin;
 
-import org.apache.qpid.server.model.Protocol;
-import org.apache.qpid.test.utils.QpidTestCase;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
 import org.mockito.Mockito;
 
-public class ProtocolEngineCreatorComparatorTest extends QpidTestCase
+import org.apache.qpid.server.model.Protocol;
+import org.apache.qpid.test.utils.UnitTestBase;
+
+public class ProtocolEngineCreatorComparatorTest extends UnitTestBase
 {
+    @Test
     public void testProtocolEngineCreatorComparator() throws Exception
     {
         final ProtocolEngineCreatorComparator comparator = new ProtocolEngineCreatorComparator();
@@ -36,21 +41,21 @@ public class ProtocolEngineCreatorComparatorTest extends QpidTestCase
         final ProtocolEngineCreator amqp_0_10 = createAMQPProtocolEngineCreatorMock(Protocol.AMQP_0_10);
         final ProtocolEngineCreator amqp_1_0 = createAMQPProtocolEngineCreatorMock(Protocol.AMQP_1_0);
 
-        assertTrue(comparator.compare(amqp_0_8,amqp_0_9) < 0);
-        assertTrue(comparator.compare(amqp_0_9,amqp_0_9_1) < 0);
-        assertTrue(comparator.compare(amqp_0_9_1,amqp_0_10) < 0);
-        assertTrue(comparator.compare(amqp_0_10,amqp_1_0) < 0);
-
-        assertTrue(comparator.compare(amqp_0_9,amqp_0_8) > 0);
-        assertTrue(comparator.compare(amqp_0_9_1,amqp_0_9) > 0);
-        assertTrue(comparator.compare(amqp_0_10,amqp_0_9_1) > 0);
-        assertTrue(comparator.compare(amqp_1_0,amqp_0_10) > 0);
-
-        assertTrue(comparator.compare(amqp_0_8,amqp_0_8) == 0);
-        assertTrue(comparator.compare(amqp_0_9,amqp_0_9) == 0);
-        assertTrue(comparator.compare(amqp_0_9_1,amqp_0_9_1) == 0);
-        assertTrue(comparator.compare(amqp_0_10,amqp_0_10) == 0);
-        assertTrue(comparator.compare(amqp_1_0,amqp_1_0) == 0);
+        assertTrue(comparator.compare(amqp_0_8, amqp_0_9) < 0);
+        assertTrue(comparator.compare(amqp_0_9, amqp_0_9_1) < 0);
+        assertTrue(comparator.compare(amqp_0_9_1, amqp_0_10) < 0);
+        assertTrue(comparator.compare(amqp_0_10, amqp_1_0) < 0);
+
+        assertTrue(comparator.compare(amqp_0_9, amqp_0_8) > 0);
+        assertTrue(comparator.compare(amqp_0_9_1, amqp_0_9) > 0);
+        assertTrue(comparator.compare(amqp_0_10, amqp_0_9_1) > 0);
+        assertTrue(comparator.compare(amqp_1_0, amqp_0_10) > 0);
+
+        assertTrue(comparator.compare(amqp_0_8, amqp_0_8) == 0);
+        assertTrue(comparator.compare(amqp_0_9, amqp_0_9) == 0);
+        assertTrue(comparator.compare(amqp_0_9_1, amqp_0_9_1) == 0);
+        assertTrue(comparator.compare(amqp_0_10, amqp_0_10) == 0);
+        assertTrue(comparator.compare(amqp_1_0, amqp_1_0) == 0);
     }
 
     private ProtocolEngineCreator createAMQPProtocolEngineCreatorMock(Protocol protocol)

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-core/src/test/java/org/apache/qpid/server/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java b/broker-core/src/test/java/org/apache/qpid/server/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java
index cc4d2e9..5b962f0 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java
@@ -21,7 +21,9 @@
 package org.apache.qpid.server.pool;
 
 
-import javax.security.auth.Subject;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.security.Principal;
@@ -32,13 +34,18 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.qpid.test.utils.QpidTestCase;
+import javax.security.auth.Subject;
+
+import org.junit.Test;
+
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class SuppressingInheritedAccessControlContextThreadFactoryTest extends QpidTestCase
+public class SuppressingInheritedAccessControlContextThreadFactoryTest extends UnitTestBase
 {
+    @Test
     public void testAccessControlContextIsNotInheritedByThread() throws Exception
     {
-        final String principalName = getName();
+        final String principalName = getTestName();
         final CountDownLatch latch = new CountDownLatch(1);
 
         final AtomicReference<AccessControlContext> threadAccessControlContextCapturer = new AtomicReference<>();
@@ -91,7 +98,6 @@ public class SuppressingInheritedAccessControlContextThreadFactoryTest extends Q
 
         assertEquals("Unexpected subject in main thread", callerSubject, subject);
         assertNull("Unexpected subject in executor thread", threadSubject);
-
     }
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java b/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java
index 26fc7dd..b3e568b 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java
@@ -20,11 +20,18 @@
 
 package org.apache.qpid.server.protocol.v0_8;
 
-import org.apache.qpid.test.utils.QpidTestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.nio.charset.StandardCharsets;
 
-public class AMQShortStringTest extends QpidTestCase
+import org.junit.Test;
+
+import org.apache.qpid.test.utils.UnitTestBase;
+
+public class AMQShortStringTest extends UnitTestBase
 {
 
     public static final AMQShortString HELLO = new AMQShortString("Hello");
@@ -34,6 +41,7 @@ public class AMQShortStringTest extends QpidTestCase
     public static final AMQShortString BYE = new AMQShortString("BYE");
 
 
+    @Test
     public void testEquals()
     {
         assertEquals(GOODBYE, new AMQShortString("Goodbye"));
@@ -45,11 +53,15 @@ public class AMQShortStringTest extends QpidTestCase
      * Test method for
      * {@link AMQShortString#AMQShortString(byte[])}.
      */
+    @Test
     public void testCreateAMQShortStringByteArray()
     {
         byte[] bytes = "test".getBytes(StandardCharsets.UTF_8);
         AMQShortString string = new AMQShortString(bytes);
-        assertEquals("constructed amq short string length differs from expected", 4, string.length());
+        assertEquals("constructed amq short string length differs from expected",
+                            (long) 4,
+                            (long) string.length());
+
 
         assertTrue("constructed amq short string differs from expected", string.toString().equals("test"));
     }
@@ -60,10 +72,12 @@ public class AMQShortStringTest extends QpidTestCase
      * <p>
      * Tests short string construction from string with length less than 255.
      */
+    @Test
     public void testCreateAMQShortStringString()
     {
         AMQShortString string = new AMQShortString("test");
-        assertEquals("constructed amq short string length differs from expected", 4, string.length());
+        assertEquals("constructed amq short string length differs from expected", (long) 4, (long) string.length
+                ());
 
         assertTrue("constructed amq short string differs from expected", string.toString().equals("test"));
     }
@@ -74,6 +88,7 @@ public class AMQShortStringTest extends QpidTestCase
      * <p>
      * Tests an attempt to create an AMQP short string from byte array with length over 255.
      */
+    @Test
     public void testCreateAMQShortStringByteArrayOver255()
     {
         String test = buildString('a', 256);
@@ -86,7 +101,9 @@ public class AMQShortStringTest extends QpidTestCase
         catch (IllegalArgumentException e)
         {
             assertEquals("Exception message differs from expected",
-                    "Cannot create AMQShortString with number of octets over 255!", e.getMessage());
+                                "Cannot create AMQShortString with number of octets over 255!",
+                                e.getMessage());
+
         }
     }
 
@@ -96,6 +113,7 @@ public class AMQShortStringTest extends QpidTestCase
      * <p>
      * Tests an attempt to create an AMQP short string from string with length over 255
      */
+    @Test
     public void testCreateAMQShortStringStringOver255()
     {
         String test = buildString('a', 256);
@@ -107,10 +125,12 @@ public class AMQShortStringTest extends QpidTestCase
         catch (IllegalArgumentException e)
         {
             assertEquals("Exception message differs from expected",
-                    "Cannot create AMQShortString with number of octets over 255!", e.getMessage());
+                                "Cannot create AMQShortString with number of octets over 255!",
+                                e.getMessage());
         }
     }
 
+    @Test
     public void testValueOf()
     {
         String string = buildString('a', 255);
@@ -118,20 +138,24 @@ public class AMQShortStringTest extends QpidTestCase
         assertEquals("Unexpected string from valueOf", string, shortString.toString());
     }
 
+    @Test
     public void testValueOfTruncated()
     {
         String string = buildString('a', 256);
         AMQShortString shortString = AMQShortString.valueOf(string, true, true);
-        assertEquals("Unexpected truncated string from valueOf", string.substring(0, AMQShortString.MAX_LENGTH -3) + "...",
-                     shortString.toString());
+        assertEquals("Unexpected truncated string from valueOf",
+                            string.substring(0, AMQShortString.MAX_LENGTH - 3) + "...",
+                            shortString.toString());
     }
 
+    @Test
     public void testValueOfNulAsEmptyString()
     {
         AMQShortString shortString = AMQShortString.valueOf(null, true, true);
         assertEquals("Unexpected empty string from valueOf", AMQShortString.EMPTY_STRING, shortString);
     }
 
+    @Test
     public void testValueOfNullAsNull()
     {
         AMQShortString shortString = AMQShortString.valueOf(null, true, false);

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQTypeTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQTypeTest.java b/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQTypeTest.java
index 9433db2..aaa1363 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQTypeTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQTypeTest.java
@@ -20,19 +20,25 @@
  */
 package org.apache.qpid.server.protocol.v0_8;
 
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
 import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class AMQTypeTest extends QpidTestCase
+public class AMQTypeTest extends UnitTestBase
 {
     private static final int SIZE = 1024;
 
+    @Test
     public void testUnsignedShort()
     {
         doTest(AMQType.UNSIGNED_SHORT, 0);
         doTest(AMQType.UNSIGNED_SHORT, 65535);
     }
 
+    @Test
     public void testUnsignedByte()
     {
         doTest(AMQType.UNSIGNED_BYTE, (short)0);

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/EncodingUtilsTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/EncodingUtilsTest.java b/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/EncodingUtilsTest.java
index c87f929..2417ff2 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/EncodingUtilsTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/EncodingUtilsTest.java
@@ -20,11 +20,17 @@
 
 package org.apache.qpid.server.protocol.v0_8;
 
-import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.test.utils.QpidTestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
+import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class EncodingUtilsTest extends QpidTestCase
+public class EncodingUtilsTest extends UnitTestBase
 {
     private static final int BUFFER_SIZE = 10;
     private static final int POOL_SIZE = 20;
@@ -32,16 +38,15 @@ public class EncodingUtilsTest extends QpidTestCase
 
     private QpidByteBuffer _buffer;
 
-    @Override
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
-        super.setUp();
         QpidByteBuffer.deinitialisePool();
         QpidByteBuffer.initialisePool(BUFFER_SIZE, POOL_SIZE, SPARSITY_FRACTION);
         _buffer = QpidByteBuffer.allocateDirect(BUFFER_SIZE);
     }
 
-    @Override
+    @After
     public void tearDown() throws Exception
     {
         try
@@ -51,10 +56,10 @@ public class EncodingUtilsTest extends QpidTestCase
         }
         finally
         {
-            super.tearDown();
         }
     }
 
+    @Test
     public void testReadLongAsShortStringWhenDigitsAreSpecified() throws Exception
     {
         _buffer.putUnsignedByte((short)3);
@@ -65,6 +70,7 @@ public class EncodingUtilsTest extends QpidTestCase
         assertEquals("Unexpected result", 920L, EncodingUtils.readLongAsShortString(_buffer));
     }
 
+    @Test
     public void testReadLongAsShortStringWhenNonDigitCharacterIsSpecified() throws Exception
     {
         _buffer.putUnsignedByte((short)2);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message