NodesParsedFromSupplier implements Supplier<LoadingCache<String, Node>> { @Override public LoadingCache<String, Node> get() { LoadingCache<String, Node> nodes = parser.apply(supplier.get()); checkState(nodes != null && nodes.size() > 0, "no nodes parsed from supplier: %s", supplier); return nodes; } @Inject  NodesParsedFromSupplier(@Provider Supplier<InputStream> supplier, Function<InputStream, LoadingCache<String, Node>> parser); @Override LoadingCache<String, Node> get();  }
@Test(expectedExceptions = IllegalStateException.class) public void testMustParseSomething() throws Exception { new NodesParsedFromSupplier(Suppliers.ofInstance(Strings2.toInputStream("nodes:\n")), new NodesFromYamlStream()).get(); }