MethodRules { public static MethodRule wrapTestRule(TestRule testRule) { return new MethodRuleWrapper(testRule); }  static MethodRule wrapTestRule(TestRule testRule);  }
@Test public void testWrappingSimpleTestRule() { Statement replacementStatement = mock(Statement.class); when(mockTestRule.apply(any(Statement.class), any(Description.class))).thenReturn(replacementStatement); when(mockFrameworkMethod.getName()).thenReturn("testMethodName"); MethodRule methodRule = MethodRules.wrapTestRule(mockTestRule); Statement resultStatement = methodRule.apply(mockStatement, mockFrameworkMethod, mockTestObject); verify(mockTestRule).apply(eq(mockStatement), descriptionCaptor.capture()); verifyNoMoreInteractions(mockStatement); assertThat(descriptionCaptor.getValue().getMethodName()).isEqualTo("testMethodName"); assertThat(resultStatement).isEqualTo(replacementStatement); }