예제 #1
0
 @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());
 }
예제 #2
0
 @Test
 public void addAllNull() {
   assertFalse(AwsSdkMetrics.addAll(null));
   assertFalse(AwsSdkMetrics.addAll(Collections.<MetricType>emptyList()));
 }