NMProfileManager { @Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.JSON_STYLE); for (Map.Entry<String, NMProfile> profile : profiles.entrySet()) { NMProfile value = profile.getValue(); builder.append("name", value.getName()); builder.append("cpus", value.getCpus()); builder.append("memory", value.getMemory()); } return builder.toString(); }  NMProfile get(String name); void add(NMProfile profile); boolean exists(String name); int numberOfProfiles(); @Override String toString();  }
@Test public void testToString() throws Exception { NMProfileManager manager = this.getNMProfileManager(); String toString = manager.toString(); assertTrue(toString.contains("\"name\":\"profile1\",\"cpus\":1,\"memory\":512")); assertTrue(toString.contains("\"name\":\"profile2\",\"cpus\":2,\"memory\":1024")); assertTrue(toString.contains("\"name\":\"profile3\",\"cpus\":3,\"memory\":2048")); assertTrue(toString.contains("\"name\":\"profile4\",\"cpus\":4,\"memory\":3072")); assertTrue(toString.contains("\"name\":\"profile5\",\"cpus\":5,\"memory\":4096")); }