Skip to content

Instantly share code, notes, and snippets.

@mroger
Last active June 2, 2016 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroger/0e5c80ed5c4dc66da09d95f3c7d9e087 to your computer and use it in GitHub Desktop.
Save mroger/0e5c80ed5c4dc66da09d95f3c7d9e087 to your computer and use it in GitHub Desktop.
MagicMatcherElse
public class MagicMatcher <T> implements InvocationHandler {
//...
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if () {
//...
} else {
if (args.length > 1) {
throw new IllegalArgumentException("Cannot assert more than one argument at once.");
}
methodMap.put(method.getName(), args[0]);
return proxy;
}
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment