InterpreterHookRegistry { public void register(String noteId, String className, String event, String cmd) throws InvalidHookException { synchronized (registry) { if (!HookType.ValidEvents.contains(event)) { throw new InvalidHookException("event " + event + " is not valid hook event"); } if (noteId == null) { noteId = GLOBAL_KEY; } addRepl(noteId, className); registry.get(noteId).get(className).put(event, cmd); } }  void register(String noteId, String className,
                       String event, String cmd); void unregister(String noteId, String className, String event); String get(String noteId, String className, String event);  }
@Test(expected = InvalidHookException.class) public void testValidEventCode() throws InvalidHookException { InterpreterHookRegistry registry = new InterpreterHookRegistry(); registry.register("foo", "bar", "baz", "whatever"); }