PrintJson implements Action { @Override public String doAction(@Nonnull Resource resource) { ValueMap properties = resource.getValueMap(); Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(properties); }  @Override String doAction(@Nonnull Resource resource);  }
@Test public void test_doAction() { PrintJson printJson = new PrintJson(); String result = printJson.doAction(resource); assertTrue(result.contains("\"sling:resourceType\": \"weretail/components/content/heroimage\"")); assertTrue(result.contains("\"number\": 123")); assertTrue(result.contains("\"multivalue\": [")); assertTrue(result.contains("\"v1\",")); assertTrue(result.contains("\"v2\",")); assertTrue(result.contains("\"v3\"")); }