@Test
public void testParseAfterKey() {

    for (String input : Arrays.asList("{" + afterKey + ", " + bucketsArr + "}", "{" + afterKey + "}")) {
        JsonObject compositeAggregationJson = gson.fromJson(
                input.replace('\'', '\"'), JsonObject.class);
        CompositeAggregation compositeAggregation = new CompositeAggregation("composite", compositeAggregationJson);
        assertEquals("valB", compositeAggregation.getAfterKey().get("field").getAsString());
    }
}