Policy { public void writePolicy(Writer writer) throws IOException { try { writer.write("{\n"); writePolicy(writer, policyRoot, 1); writer.write("}\n"); } finally { IOUtil.closeSilently(writer); } }  abstract String getName(); abstract FactMetaData getRootFactMetaData(); void setPolicyConfig(PolicyConfig policyConfig); void addViolationsToPolicy(); void collapsePolicy(); void parsePolicy(Reader reader); void writePolicy(Writer writer); String[][] getViolations(); String[][] getViolations(long sinceTime);  }
@Test public void testEmptyPolicy() throws IOException { File file = File.createTempFile("test-policy", null); Policy policy = new SimplePolicy(); policy.writePolicy(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)); assertEquals(IOUtil.readFile(file), "{\n}\n"); }