From 9fe9e27189840b2c1b0aff9f5be2b04e2be20c96 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 5 Feb 2014 15:52:53 +0100 Subject: [PATCH] Explain after advice behavior in static method mock aspect This commit makes it clear that mock verification will not occur if an advised test method throws an exception. --- ...otationDrivenStaticEntityMockingControl.aj | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/spring-aspects/src/main/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControl.aj b/spring-aspects/src/main/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControl.aj index a9985e9c7e..03da850fdc 100644 --- a/spring-aspects/src/main/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControl.aj +++ b/spring-aspects/src/main/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControl.aj @@ -27,18 +27,21 @@ package org.springframework.mock.staticmock; *

This aspect also provides static methods to simplify the programming model for * setting expectations and entering playback mode. * - *

Usage: + *

Usage

*
    *
  1. Annotate a test class with {@code @MockStaticEntityMethods}. - *
  2. In each test method, {@code AnnotationDrivenStaticEntityMockingControl} + *
  3. In each test method, the {@code AnnotationDrivenStaticEntityMockingControl} * will begin in recording mode. *
  4. Invoke static methods on JPA-annotated {@code @Entity} classes, with each - * recording-mode invocation being followed by an invocation of either the static - * {@link #expectReturn(Object)} method or the static {@link #expectThrow(Throwable)} - * method on {@code AnnotationDrivenStaticEntityMockingControl}. - *
  5. Invoke the static {@link #playback()} method. - *
  6. Call the code you wish to test that uses the static methods. - *
  7. Verification will occur automatically. + * recording-mode invocation being followed by an invocation of either + * {@link #expectReturn(Object)} or {@link #expectThrow(Throwable)} on the + * {@code AnnotationDrivenStaticEntityMockingControl}. + *
  8. Invoke the {@link #playback()} method. + *
  9. Call the code you wish to test that uses the static methods on the + * JPA-annotated {@code @Entity} classes. + *
  10. Verification will occur automatically after the test method has executed + * and returned. However, mock verification will not occur if the test method + * throws an exception. *
* * @author Rod Johnson