@Test public void getInterceptionHandler_whenCallIsNotRecognized_shouldReturnDoNothingHandler() throws Exception { MethodSignature methodSignature = MethodSignature.parse("java/lang/Object/unknownMethod()V"); Function<Object, Object> handler = shadowWrangler.getInterceptionHandler(methodSignature); assertThat(handler).isNotNull().isSameAs(ShadowWrangler.DO_NOTHING_HANDLER); assertThat(handler.call(null)).isNull(); }
@Test public void getInterceptionHandler_whenInterceptingElderOnLinkedHashMap_shouldReturnNonDoNothingHandler() throws Exception { MethodSignature methodSignature = MethodSignature.parse("java/util/LinkedHashMap/eldest()Ljava/lang/Object"); Function<Object, Object> handler = shadowWrangler.getInterceptionHandler(methodSignature); assertThat(handler).isNotSameAs(ShadowWrangler.DO_NOTHING_HANDLER); }