@Test(expected = ValidationException.class) public void testUnknownOption() throws ValidationException { Spec spec = new Spec(); spec.validate(of("bla", "a value")); }
public YConfiguration validate(YConfiguration args) throws ValidationException { ValidationContext ctx = new ValidationContext(); ctx.path = args.getPath(); Map<String, Object> result = doValidate(ctx, args.getRoot(), ""); YConfiguration wrapped = YConfiguration.wrap(result); wrapped.parent = args.parent; wrapped.parentKey = args.parentKey; wrapped.rootLocation = args.rootLocation; return wrapped; }
Spec { public YConfiguration validate(YConfiguration args) throws ValidationException { ValidationContext ctx = new ValidationContext(); ctx.path = args.getPath(); Map<String, Object> result = doValidate(ctx, args.getRoot(), ""); YConfiguration wrapped = YConfiguration.wrap(result); wrapped.parent = args.parent; wrapped.parentKey = args.parentKey; wrapped.rootLocation = args.rootLocation; return wrapped; } }
Spec { public YConfiguration validate(YConfiguration args) throws ValidationException { ValidationContext ctx = new ValidationContext(); ctx.path = args.getPath(); Map<String, Object> result = doValidate(ctx, args.getRoot(), ""); YConfiguration wrapped = YConfiguration.wrap(result); wrapped.parent = args.parent; wrapped.parentKey = args.parentKey; wrapped.rootLocation = args.rootLocation; return wrapped; }  }
Spec { public YConfiguration validate(YConfiguration args) throws ValidationException { ValidationContext ctx = new ValidationContext(); ctx.path = args.getPath(); Map<String, Object> result = doValidate(ctx, args.getRoot(), ""); YConfiguration wrapped = YConfiguration.wrap(result); wrapped.parent = args.parent; wrapped.parentKey = args.parentKey; wrapped.rootLocation = args.rootLocation; return wrapped; }  Option addOption(String name, OptionType type); void allowUnknownKeys(boolean allowUnknownKeys); void requireOneOf(String... keys); void requireTogether(String... keys); void mutuallyExclusive(String... keys); WhenCondition when(String key, Object value); YConfiguration validate(YConfiguration args); Map<String, Object> validate(Map<String, Object> args); Collection<Option> getOptions(); Map<String, Object> removeSecrets(Map<String, Object> unsafeArgs); Map<String, Object> maskSecrets(Map<String, Object> unsafeArgs); @SuppressWarnings("unchecked") static Spec fromDescriptor(Map<String, Map<String, Object>> optionDescriptors); }
Spec { public YConfiguration validate(YConfiguration args) throws ValidationException { ValidationContext ctx = new ValidationContext(); ctx.path = args.getPath(); Map<String, Object> result = doValidate(ctx, args.getRoot(), ""); YConfiguration wrapped = YConfiguration.wrap(result); wrapped.parent = args.parent; wrapped.parentKey = args.parentKey; wrapped.rootLocation = args.rootLocation; return wrapped; }  Option addOption(String name, OptionType type); void allowUnknownKeys(boolean allowUnknownKeys); void requireOneOf(String... keys); void requireTogether(String... keys); void mutuallyExclusive(String... keys); WhenCondition when(String key, Object value); YConfiguration validate(YConfiguration args); Map<String, Object> validate(Map<String, Object> args); Collection<Option> getOptions(); Map<String, Object> removeSecrets(Map<String, Object> unsafeArgs); Map<String, Object> maskSecrets(Map<String, Object> unsafeArgs); @SuppressWarnings("unchecked") static Spec fromDescriptor(Map<String, Map<String, Object>> optionDescriptors); static final Spec ANY; }