@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\"")); }
@Override public String doAction(@Nonnull Resource resource) { ValueMap properties = resource.getValueMap(); Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(properties); }
PrintJson implements Action { @Override public String doAction(@Nonnull Resource resource) { ValueMap properties = resource.getValueMap(); Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(properties); } }
PrintJson implements Action { @Override public String doAction(@Nonnull Resource resource) { ValueMap properties = resource.getValueMap(); Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(properties); }  }
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); }
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);  }