@Test public void formatResponseStringNoFields() throws Exception { List<Metadata> metadataList = new ArrayList<Metadata>(); Metadata.Item itemName = new Metadata.Item("default", "table1"); Metadata metadata = new Metadata(itemName, null); metadataList.add(metadata); try { response = MetadataResponseFormatter.formatResponse(metadataList, "path.file"); convertResponseToString(response); fail("formatting should fail because fields field is null"); } catch (IllegalArgumentException e) { assertEquals("metadata for " + metadata.getItem() + " contains no fields - cannot serialize", e.getMessage()); } ArrayList<Metadata.Field> fields = new ArrayList<Metadata.Field>(); metadataList = new ArrayList<Metadata>(); metadata = new Metadata(itemName, fields); metadataList.add(metadata); try { response = MetadataResponseFormatter.formatResponse(metadataList, "path.file"); convertResponseToString(response); fail("formatting should fail because there are no fields"); } catch (IllegalArgumentException e) { assertEquals("metadata for " + metadata.getItem() + " contains no fields - cannot serialize", e.getMessage()); } }
public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); }
MetadataResponseFormatter { public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); } }
MetadataResponseFormatter { public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); }  }
MetadataResponseFormatter { public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); }  static MetadataResponse formatResponse(List<Metadata> metadataList, String path); }
MetadataResponseFormatter { public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); }  static MetadataResponse formatResponse(List<Metadata> metadataList, String path);  }