|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
|
* Copyright 2002-2014 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -17,29 +17,32 @@
@@ -17,29 +17,32 @@
|
|
|
|
|
package org.springframework.mock.staticmock; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Annotation-based aspect to use in test build to enable mocking static methods |
|
|
|
|
* on JPA-annotated {@code @Entity} classes, as used by Roo for finders. |
|
|
|
|
* Annotation-based aspect to use in test builds to enable mocking static methods |
|
|
|
|
* on JPA-annotated {@code @Entity} classes, as used by Spring Roo for finders. |
|
|
|
|
* |
|
|
|
|
* <p>Mocking will occur in the call stack of any method in a class (typically a test class) |
|
|
|
|
* that is annotated with the @MockStaticEntityMethods annotation. |
|
|
|
|
* that is annotated with the {@code @MockStaticEntityMethods} annotation. |
|
|
|
|
* |
|
|
|
|
* <p>Also provides static methods to simplify the programming model for |
|
|
|
|
* entering playback mode and setting expected return values. |
|
|
|
|
* |
|
|
|
|
* <p>Usage: |
|
|
|
|
* <ol> |
|
|
|
|
* <li>Annotate a test class with @MockStaticEntityMethods. |
|
|
|
|
* <li>In each test method, AnnotationDrivenStaticEntityMockingControl will begin in recording mode. |
|
|
|
|
* Invoke static methods on Entity classes, with each recording-mode invocation |
|
|
|
|
* being followed by an invocation to the static expectReturn() or expectThrow() |
|
|
|
|
* method on AnnotationDrivenStaticEntityMockingControl. |
|
|
|
|
* <li>Invoke the static AnnotationDrivenStaticEntityMockingControl() method. |
|
|
|
|
* <li>Call the code you wish to test that uses the static methods. Verification will |
|
|
|
|
* occur automatically. |
|
|
|
|
* <li>Annotate a test class with {@code @MockStaticEntityMethods}. |
|
|
|
|
* <li>In each test method, {@code AnnotationDrivenStaticEntityMockingControl} |
|
|
|
|
* will begin in recording mode. |
|
|
|
|
* <li>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}. |
|
|
|
|
* <li>Invoke the static {@link #playback()} method. |
|
|
|
|
* <li>Call the code you wish to test that uses the static methods. |
|
|
|
|
* <li>Verification will occur automatically. |
|
|
|
|
* </ol> |
|
|
|
|
* |
|
|
|
|
* @author Rod Johnson |
|
|
|
|
* @author Ramnivas Laddad |
|
|
|
|
* @author Sam Brannen |
|
|
|
|
* @see MockStaticEntityMethods |
|
|
|
|
*/ |
|
|
|
|
public aspect AnnotationDrivenStaticEntityMockingControl extends AbstractMethodMockingControl { |
|
|
|
|
|