@Test public void addAndRemove() { Set<MetricType> orig = AwsSdkMetrics.getPredefinedMetrics(); AwsSdkMetrics.set(null); // Test add and remove assertTrue(AwsSdkMetrics.getPredefinedMetrics().isEmpty()); AwsSdkMetrics.add(Field.ClientExecuteTime); assertFalse(AwsSdkMetrics.getPredefinedMetrics().isEmpty()); AwsSdkMetrics.remove(Field.ClientExecuteTime); assertTrue(AwsSdkMetrics.getPredefinedMetrics().isEmpty()); // Test add more than one entry AwsSdkMetrics.add(Field.ClientExecuteTime); AwsSdkMetrics.add(Field.Exception); assertTrue(AwsSdkMetrics.getPredefinedMetrics().size() == 2); AwsSdkMetrics.set(null); assertTrue(AwsSdkMetrics.getPredefinedMetrics().isEmpty()); // Test addAll AwsSdkMetrics.addAll(Arrays.asList(Field.Exception, Field.ClientExecuteTime)); assertTrue(AwsSdkMetrics.getPredefinedMetrics().size() == 2); AwsSdkMetrics.set(orig); assertTrue(AwsSdkMetrics.getPredefinedMetrics().size() == orig.size()); }
@Test public void removeNull() { assertFalse(AwsSdkMetrics.remove(null)); }