@Override
  @SuppressWarnings("unchecked")
  public void afterTestMethod(SpringTestContext testContext) throws Exception {
    List<Object> mockedBeans = (List<Object>) testContext.getAttribute(MOCKED_BEANS_LIST);

    if (mockedBeans != null) {
      for (Object object : mockedBeans) {
        mockUtil.detachMock(object);
      }
    }
  }
This {@link TestExecutionListener} takes care of attaching and detaching the
mocks to the current {@link Specification}.

@author Leonard Bruenings
spock-spring/src/main/java/org/spockframework/spring/SpringMockTestExecutionListener.java