ViewInfo { public String toPrettyPrintingJson() throws IOException { Map<Integer, List<String>> simplifiedPartitionMap = new TreeMap<Integer, List<String>>(); for (Map.Entry<String, List<String>> entry : partitionMap.entrySet()) { String longPartitionName = entry.getKey(); int partitionNumber = TerrapinUtil.getViewPartitionNumber(longPartitionName); simplifiedPartitionMap.put(partitionNumber, entry.getValue()); } return OBJECT_MAPPER.defaultPrettyPrintingWriter().writeValueAsString(simplifiedPartitionMap); } ViewInfo();  ViewInfo(ExternalView externalView); static ViewInfo fromJson(byte[] json); List<String> getInstancesForPartition(String partition); boolean hasOnlinePartitions(); @JsonIgnore int getNumOnlinePartitions(); @JsonIgnore String getResource(); @Override boolean equals(Object o); byte[] toJson(); static ViewInfo fromCompressedJson(byte[] compressedJson); byte[] toCompressedJson(); String toPrettyPrintingJson(); boolean isOnlinePartition(String partition);  }
@Test public void testToPrettyPrintingJson() { try { String expected = "{\n" + " \"1\" : [ \"host2\", \"host3\" ],\n" + " \"3\" : [ \"host1\" ]\n" + "}"; assertEquals(expected, viewInfo.toPrettyPrintingJson()); } catch (IOException e) { e.printStackTrace(); fail("translating to pretty printing json raises exception: " + e.getMessage()); } }