From 5adf702b6e2c66ad0f7098ed53fcbc7dd568b2d2 Mon Sep 17 00:00:00 2001 From: Robert Godfrey Date: Tue, 27 Jan 2015 22:23:04 +0000 Subject: QPID-6341 : Fix test git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1655180 13f79535-47bb-0310-9956-ffa450edef68 --- .../servlet/rest/ConfiguredObjectToMapConverterTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'qpid/java') diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java index f22135ef61..8687330d49 100644 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java +++ b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java @@ -20,6 +20,7 @@ package org.apache.qpid.server.management.plugin.servlet.rest; import static org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.STATISTICS_MAP_KEY; +import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; @@ -37,6 +38,8 @@ import java.util.Set; import junit.framework.TestCase; import org.apache.qpid.server.model.ConfiguredObject; +import org.apache.qpid.server.model.ConfiguredObjectAttribute; +import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.Model; public class ConfiguredObjectToMapConverterTest extends TestCase @@ -75,6 +78,8 @@ public class ConfiguredObjectToMapConverterTest extends TestCase { final String attributeName = "attribute"; final String attributeValue = "value"; + Model model = createTestModel(); + when(_configuredObject.getModel()).thenReturn(model); configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue); Map resultMap = _converter.convertObjectToMap(_configuredObject, @@ -217,6 +222,11 @@ public class ConfiguredObjectToMapConverterTest extends TestCase final List> list = new ArrayList>(); list.add(TestChild.class); when(model.getChildTypes(ConfiguredObject.class)).thenReturn(list); + final ConfiguredObjectTypeRegistry typeRegistry = mock(ConfiguredObjectTypeRegistry.class); + final Map> attrTypes = mock(Map.class); + when(attrTypes.get(any(String.class))).thenReturn(mock(ConfiguredObjectAttribute.class)); + when(typeRegistry.getAttributeTypes(any(Class.class))).thenReturn(attrTypes); + when(model.getTypeRegistry()).thenReturn(typeRegistry); return model; } -- cgit v1.2.1