@Test @DisplayName("KeySet can be constrained") void testConstrainingKeys() { final var source = new TestSource(); final var mnemonic = "TestGen"; final var sut = new CompoundParams("theId", JVM8Tools.asMap( "a", "1", "b", "2", "c", "3") ); Assertions.assertThrows(GeciException.class, () -> sut.setConstraints(source, mnemonic, new HashSet<>(Arrays.asList("a", "c", "e")))); Assertions.assertDoesNotThrow(() -> sut.setConstraints(source, mnemonic, new HashSet<>(Arrays.asList("a", "b", "c", "d", "e")))); }
@Override public void setConstraints(Source source, String mnemonic, Set<String> allowedKeys) { this.source = source; this.mnemonic = mnemonic; this.allowedKeys = allowedKeys; if (source != null && allowedKeys != null) { checkAllowedKeys(); } }
CompoundParams implements javax0.geci.api.CompoundParams { @Override public void setConstraints(Source source, String mnemonic, Set<String> allowedKeys) { this.source = source; this.mnemonic = mnemonic; this.allowedKeys = allowedKeys; if (source != null && allowedKeys != null) { checkAllowedKeys(); } } }
CompoundParams implements javax0.geci.api.CompoundParams { @Override public void setConstraints(Source source, String mnemonic, Set<String> allowedKeys) { this.source = source; this.mnemonic = mnemonic; this.allowedKeys = allowedKeys; if (source != null && allowedKeys != null) { checkAllowedKeys(); } } @SafeVarargs  CompoundParams(String id, Map<String, ?>... params);  CompoundParams(CompoundParams... cparams); }
CompoundParams implements javax0.geci.api.CompoundParams { @Override public void setConstraints(Source source, String mnemonic, Set<String> allowedKeys) { this.source = source; this.mnemonic = mnemonic; this.allowedKeys = allowedKeys; if (source != null && allowedKeys != null) { checkAllowedKeys(); } } @SafeVarargs  CompoundParams(String id, Map<String, ?>... params);  CompoundParams(CompoundParams... cparams); void trace(); @Override void setConstraints(Source source, String mnemonic, Set<String> allowedKeys); @Override String get(String key, String defaults); @Override String get(String key, Supplier<String> defaultSupplier); @Override String get(String key); @Override String id(String mnemonic); @Override List<String> getValueList(String key, List<String> defaults); @Override List<String> getValueList(String key); @Override boolean is(String key); @Override boolean is(String key, boolean defaultValue); @Override boolean is(String key, String defaultValue); @Override Set<String> keySet(); @Override String toString(); }
CompoundParams implements javax0.geci.api.CompoundParams { @Override public void setConstraints(Source source, String mnemonic, Set<String> allowedKeys) { this.source = source; this.mnemonic = mnemonic; this.allowedKeys = allowedKeys; if (source != null && allowedKeys != null) { checkAllowedKeys(); } } @SafeVarargs  CompoundParams(String id, Map<String, ?>... params);  CompoundParams(CompoundParams... cparams); void trace(); @Override void setConstraints(Source source, String mnemonic, Set<String> allowedKeys); @Override String get(String key, String defaults); @Override String get(String key, Supplier<String> defaultSupplier); @Override String get(String key); @Override String id(String mnemonic); @Override List<String> getValueList(String key, List<String> defaults); @Override List<String> getValueList(String key); @Override boolean is(String key); @Override boolean is(String key, boolean defaultValue); @Override boolean is(String key, String defaultValue); @Override Set<String> keySet(); @Override String toString();  }