@Test public void testProvided() { checkParser(new PartitionStrategy.Builder().provided("version").build(), "[ {\"type\": \"provided\", \"name\": \"version\"} ]"); checkParser(new PartitionStrategy.Builder().provided("version").build(), "[ {\"type\": \"provided\", \"name\": \"version\", \"values\": \"string\"} ]"); checkParser(new PartitionStrategy.Builder().provided("version", "string").build(), "[ {\"type\": \"provided\", \"name\": \"version\", \"values\": \"string\"} ]"); checkParser(new PartitionStrategy.Builder().provided("version", "int").build(), "[ {\"type\": \"provided\", \"name\": \"version\", \"values\": \"int\"} ]"); checkParser(new PartitionStrategy.Builder().provided("version", "long").build(), "[ {\"type\": \"provided\", \"name\": \"version\", \"values\": \"long\"} ]"); TestHelpers.assertThrows("Should reject missing name", ValidationException.class, new Runnable() { @Override public void run() { PartitionStrategyParser.parse("[ {\"type\": \"provided\"} ]"); } }); TestHelpers.assertThrows("Should reject unsupported values type", ValidationException.class, new Runnable() { @Override public void run() { PartitionStrategyParser.parse("[ {" + "\"type\": \"provided\", " + "\"name\": \"version\", " + "\"values\": \"float\"" + "} ]"); } }); TestHelpers.assertThrows("Should reject invalid values type", ValidationException.class, new Runnable() { @Override public void run() { PartitionStrategyParser.parse("[ {" + "\"type\": \"provided\", " + "\"name\": \"version\", " + "\"values\": \"unknown\"" + "} ]"); } }); }
public static PartitionStrategy parse(String json) { return buildPartitionStrategy(JsonUtil.parse(json)); }
PartitionStrategyParser { public static PartitionStrategy parse(String json) { return buildPartitionStrategy(JsonUtil.parse(json)); } }
PartitionStrategyParser { public static PartitionStrategy parse(String json) { return buildPartitionStrategy(JsonUtil.parse(json)); }  }
PartitionStrategyParser { public static PartitionStrategy parse(String json) { return buildPartitionStrategy(JsonUtil.parse(json)); }  static PartitionStrategy parse(String json); static PartitionStrategy parse(File file); static PartitionStrategy parse(InputStream in); static boolean hasEmbeddedStrategy(Schema schema); static PartitionStrategy parseFromSchema(Schema schema); static Schema removeEmbeddedStrategy(Schema schema); static Schema embedPartitionStrategy(Schema schema, PartitionStrategy strategy); static String toString(PartitionStrategy strategy, boolean pretty); }
PartitionStrategyParser { public static PartitionStrategy parse(String json) { return buildPartitionStrategy(JsonUtil.parse(json)); }  static PartitionStrategy parse(String json); static PartitionStrategy parse(File file); static PartitionStrategy parse(InputStream in); static boolean hasEmbeddedStrategy(Schema schema); static PartitionStrategy parseFromSchema(Schema schema); static Schema removeEmbeddedStrategy(Schema schema); static Schema embedPartitionStrategy(Schema schema, PartitionStrategy strategy); static String toString(PartitionStrategy strategy, boolean pretty);  }