Format Java code to ONAP standard
[aai/search-data-service.git] / src / test / java / org / onap / aai / sa / searchdbabstraction / searchapi / AggregationTest.java
index d85e075..12b18d1 100644 (file)
@@ -27,22 +27,25 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import org.junit.Test;
 
 public class AggregationTest {
-  private static ObjectMapper mapper = new ObjectMapper();
-//
-  @Test
-  public void test() {
-    String input = "{\r\n  \"name\": \"byDate\",\r\n  \"aggregation\": {\r\n    \"date-range\": {\r\n      \"field\": \"mydate\",\r\n      \"ranges\": [\r\n        {\r\n          \"from\": \"2016-12-19T00:00:00.738-05:00\",\r\n          \"to\": \"2016-12-23T23:59:59.738-05:00\"\r\n        }\r\n      ]\r\n    },\r\n    \"sub-aggregations\": [{\r\n        \"name\": \"byTerm\",\r\n        \"aggregation\": {\r\n          \"group-by\": {\r\n            \"field\": \"myterm\"\r\n          }\r\n        }\r\n      }]\r\n  }\r\n}";
-
-    String expected = "\"byDate\": {\"date_range\": {\"field\": \"mydate\", \"ranges\": [{\"from\": \"2016-12-19T00:00:00.738-05:00\", \"to\": \"2016-12-23T23:59:59.738-05:00\"}]}, \"aggs\": {\"byTerm\": {\"terms\": {\"field\": \"myterm\"}}}}";
-
-    Aggregation actual;
-    try {
-      actual = mapper.readValue(input, Aggregation.class);
-      assertEquals(expected, actual.toElasticSearch());
-    } catch (Exception e) {
-      fail("Exception occurred: " + e.getMessage());
-    }
+    private static ObjectMapper mapper = new ObjectMapper();
+
+    //
+    @Test
+    public void test() {
+        String input =
+                "{\r\n  \"name\": \"byDate\",\r\n  \"aggregation\": {\r\n    \"date-range\": {\r\n      \"field\": \"mydate\",\r\n      \"ranges\": [\r\n        {\r\n          \"from\": \"2016-12-19T00:00:00.738-05:00\",\r\n          \"to\": \"2016-12-23T23:59:59.738-05:00\"\r\n        }\r\n      ]\r\n    },\r\n    \"sub-aggregations\": [{\r\n        \"name\": \"byTerm\",\r\n        \"aggregation\": {\r\n          \"group-by\": {\r\n            \"field\": \"myterm\"\r\n          }\r\n        }\r\n      }]\r\n  }\r\n}";
+
+        String expected =
+                "\"byDate\": {\"date_range\": {\"field\": \"mydate\", \"ranges\": [{\"from\": \"2016-12-19T00:00:00.738-05:00\", \"to\": \"2016-12-23T23:59:59.738-05:00\"}]}, \"aggs\": {\"byTerm\": {\"terms\": {\"field\": \"myterm\"}}}}";
 
-  }
+        Aggregation actual;
+        try {
+            actual = mapper.readValue(input, Aggregation.class);
+            assertEquals(expected, actual.toElasticSearch());
+        } catch (Exception e) {
+            fail("Exception occurred: " + e.getMessage());
+        }
+
+    }
 
 }