@Test(expected = IllegalArgumentException.class) public void testValidEventCode() { InterpreterHookRegistry registry = new InterpreterHookRegistry("intpId"); registry.register("foo", "bar", "baz", "whatever"); }
public void register(String noteId, String className, String event, String cmd) throws IllegalArgumentException { synchronized (registry) { if (noteId == null) { noteId = GLOBAL_KEY; } addRepl(noteId, className); if (!event.equals(HookType.POST_EXEC) && !event.equals(HookType.PRE_EXEC) && !event.equals(HookType.POST_EXEC_DEV) && !event.equals(HookType.PRE_EXEC_DEV)) { throw new IllegalArgumentException("Must be " + HookType.POST_EXEC + ", " + HookType.POST_EXEC_DEV + ", " + HookType.PRE_EXEC + " or " + HookType.PRE_EXEC_DEV); } registry.get(noteId).get(className).put(event, cmd); } }
InterpreterHookRegistry { public void register(String noteId, String className, String event, String cmd) throws IllegalArgumentException { synchronized (registry) { if (noteId == null) { noteId = GLOBAL_KEY; } addRepl(noteId, className); if (!event.equals(HookType.POST_EXEC) && !event.equals(HookType.PRE_EXEC) && !event.equals(HookType.POST_EXEC_DEV) && !event.equals(HookType.PRE_EXEC_DEV)) { throw new IllegalArgumentException("Must be " + HookType.POST_EXEC + ", " + HookType.POST_EXEC_DEV + ", " + HookType.PRE_EXEC + " or " + HookType.PRE_EXEC_DEV); } registry.get(noteId).get(className).put(event, cmd); } } }
InterpreterHookRegistry { public void register(String noteId, String className, String event, String cmd) throws IllegalArgumentException { synchronized (registry) { if (noteId == null) { noteId = GLOBAL_KEY; } addRepl(noteId, className); if (!event.equals(HookType.POST_EXEC) && !event.equals(HookType.PRE_EXEC) && !event.equals(HookType.POST_EXEC_DEV) && !event.equals(HookType.PRE_EXEC_DEV)) { throw new IllegalArgumentException("Must be " + HookType.POST_EXEC + ", " + HookType.POST_EXEC_DEV + ", " + HookType.PRE_EXEC + " or " + HookType.PRE_EXEC_DEV); } registry.get(noteId).get(className).put(event, cmd); } } InterpreterHookRegistry(final String interpreterId); }
InterpreterHookRegistry { public void register(String noteId, String className, String event, String cmd) throws IllegalArgumentException { synchronized (registry) { if (noteId == null) { noteId = GLOBAL_KEY; } addRepl(noteId, className); if (!event.equals(HookType.POST_EXEC) && !event.equals(HookType.PRE_EXEC) && !event.equals(HookType.POST_EXEC_DEV) && !event.equals(HookType.PRE_EXEC_DEV)) { throw new IllegalArgumentException("Must be " + HookType.POST_EXEC + ", " + HookType.POST_EXEC_DEV + ", " + HookType.PRE_EXEC + " or " + HookType.PRE_EXEC_DEV); } registry.get(noteId).get(className).put(event, cmd); } } InterpreterHookRegistry(final String interpreterId); String getInterpreterId(); void addNote(String noteId); void addRepl(String noteId, String className); 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); }
InterpreterHookRegistry { public void register(String noteId, String className, String event, String cmd) throws IllegalArgumentException { synchronized (registry) { if (noteId == null) { noteId = GLOBAL_KEY; } addRepl(noteId, className); if (!event.equals(HookType.POST_EXEC) && !event.equals(HookType.PRE_EXEC) && !event.equals(HookType.POST_EXEC_DEV) && !event.equals(HookType.PRE_EXEC_DEV)) { throw new IllegalArgumentException("Must be " + HookType.POST_EXEC + ", " + HookType.POST_EXEC_DEV + ", " + HookType.PRE_EXEC + " or " + HookType.PRE_EXEC_DEV); } registry.get(noteId).get(className).put(event, cmd); } } InterpreterHookRegistry(final String interpreterId); String getInterpreterId(); void addNote(String noteId); void addRepl(String noteId, String className); 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); static final String GLOBAL_KEY; }