diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2014-02-25 01:19:43 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2014-02-25 01:19:43 +0000 |
| commit | ddba94d2538db03bdca182ab29309ebf83cd81c9 (patch) | |
| tree | 4b0ef0435ddd2c4106af2b35982967b300082802 /qpid/java/broker-plugins/management-http/src/test | |
| parent | 2c02e80ee4907c42764d76018e8bfa9a71641822 (diff) | |
| download | qpid-python-ddba94d2538db03bdca182ab29309ebf83cd81c9.tar.gz | |
QPID-5579 : Use annotations to generate statistics values
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1571510 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http/src/test')
| -rw-r--r-- | qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java | 13 |
1 files changed, 2 insertions, 11 deletions
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 8e5c5e1c10..0c2b6a5385 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 @@ -25,6 +25,7 @@ import static org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredOb import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -32,7 +33,6 @@ import junit.framework.TestCase; import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.model.Model; -import org.apache.qpid.server.model.Statistics; public class ConfiguredObjectToMapConverterTest extends TestCase { @@ -50,8 +50,7 @@ public class ConfiguredObjectToMapConverterTest extends TestCase final String statisticName = "statisticName"; final int statisticValue = 10; - Statistics mockStatistics = createMockStatistics(statisticName, statisticValue); - when(_configuredObject.getStatistics()).thenReturn(mockStatistics); + when(_configuredObject.getStatistics()).thenReturn(Collections.singletonMap(statisticName, (Number) statisticValue)); Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 0); Map<String, Object> statsAsMap = (Map<String, Object>) resultMap.get(STATISTICS_MAP_KEY); @@ -127,14 +126,6 @@ public class ConfiguredObjectToMapConverterTest extends TestCase when(mockConfiguredObject.getAttribute(attributeName)).thenReturn(attributeValue); } - private Statistics createMockStatistics(String statName, int statValue) - { - Statistics mockStatistics = mock(Statistics.class); - when(mockStatistics.getStatisticNames()).thenReturn(Arrays.asList(statName)); - when(mockStatistics.getStatistic(statName)).thenReturn(statValue); - return mockStatistics; - } - private static interface TestChild extends ConfiguredObject { } |
