@Test public void onlyAcceptsValidIdentifiersWhileRegistering() { assertThatThrownBy(() -> new APIs(mock(Function.class)).register("a-b.c", new Object())) .hasMessage("Only JavaScript identifiers are allowed for baseName"); }
void register(String baseName, Object api) { if(!baseName.matches("[a-z_][a-zA-Z_0-9]*")) { throw new IllegalArgumentException("Only JavaScript identifiers are allowed for baseName"); } apis.put(baseName, api); cachedApis = Collections.unmodifiableMap(apis); }
APIs { void register(String baseName, Object api) { if(!baseName.matches("[a-z_][a-zA-Z_0-9]*")) { throw new IllegalArgumentException("Only JavaScript identifiers are allowed for baseName"); } apis.put(baseName, api); cachedApis = Collections.unmodifiableMap(apis); } }
APIs { void register(String baseName, Object api) { if(!baseName.matches("[a-z_][a-zA-Z_0-9]*")) { throw new IllegalArgumentException("Only JavaScript identifiers are allowed for baseName"); } apis.put(baseName, api); cachedApis = Collections.unmodifiableMap(apis); } APIs(Function<Supplier<Map<String, Object>>, CefMessageRouter> createMessageRouterForApis); }
APIs { void register(String baseName, Object api) { if(!baseName.matches("[a-z_][a-zA-Z_0-9]*")) { throw new IllegalArgumentException("Only JavaScript identifiers are allowed for baseName"); } apis.put(baseName, api); cachedApis = Collections.unmodifiableMap(apis); } APIs(Function<Supplier<Map<String, Object>>, CefMessageRouter> createMessageRouterForApis);  }
APIs { void register(String baseName, Object api) { if(!baseName.matches("[a-z_][a-zA-Z_0-9]*")) { throw new IllegalArgumentException("Only JavaScript identifiers are allowed for baseName"); } apis.put(baseName, api); cachedApis = Collections.unmodifiableMap(apis); } APIs(Function<Supplier<Map<String, Object>>, CefMessageRouter> createMessageRouterForApis);   }