@Test public void getProviderJSON() throws ParseException { Provider provider = new Provider(); provider.setHref("/11"); provider.setId(11); provider.setName("Nome"); provider.setVmmUrl("Punto final"); Link linkParent = new Link(); linkParent.setRel("parent"); linkParent.setHref("/"); linkParent.setType(PROVIDER_REGISTRY_NAMESPACE); Link linkSelf = new Link(); linkSelf.setRel("self"); linkSelf.setHref("/11"); linkSelf.setType(PROVIDER_REGISTRY_NAMESPACE); provider.addLink(linkSelf); provider.addLink(linkParent); String json = Converter.getProviderJSON(provider); System.out.println(json); JSONParser parser = new JSONParser(); Object obj = parser.parse(json); JSONObject jsonObject = (JSONObject) obj; assertEquals("/11", (String) jsonObject.get("href")); assertEquals("Punto final", (String) jsonObject.get("vmm-url")); }
public static String getProviderJSON(Provider provider) { return toJSON(Provider.class, provider); }
Converter { public static String getProviderJSON(Provider provider) { return toJSON(Provider.class, provider); } }
Converter { public static String getProviderJSON(Provider provider) { return toJSON(Provider.class, provider); }  }
Converter { public static String getProviderJSON(Provider provider) { return toJSON(Provider.class, provider); }  static Provider getProviderObject(String xml); static String getProviderXML(Provider provider); static String getRootCollectionJSON(List<Provider> providers); static String getRootCollectionXML(List<Provider> providers); static String getProviderJSON(Provider provider); static Provider getProviderFromJSON(String json); }
Converter { public static String getProviderJSON(Provider provider) { return toJSON(Provider.class, provider); }  static Provider getProviderObject(String xml); static String getProviderXML(Provider provider); static String getRootCollectionJSON(List<Provider> providers); static String getRootCollectionXML(List<Provider> providers); static String getProviderJSON(Provider provider); static Provider getProviderFromJSON(String json);  }