* <ul>
* <li>model relationships
* <li>incremental compilation
+ * <li>ltw
+ * <li>generic factory methods
+ * <li>showWeaveInfo
+ * <li>Clashing with existing methods
+ * <li>varying parameter type on the factory method
+ * <li>See CaseF - what if mixin target is not assignable to the parameter type? create cast?
* </ul>
*
* @author Andy Clement
*/
public class DeclareMixinTests extends org.aspectj.testing.XMLBasedAjcTestCase {
- public void testSimpleCase() {
- // runTest("simple case");
+ // Very basics with a simple static factory method
+ public void testCaseA() {
+ runTest("casea");
+ }
+
+ // non static factory method, will need aspectOf() calling on
+ // the aspect before the factory is called
+ public void testCaseB() {
+ runTest("caseb");
+ }
+
+ // factory method takes the object for which the delegate exists
+ public void testCaseC() {
+ runTest("casec");
+ }
+
+ // factory method is non static and takes the object for which the delegate is being created
+ public void testCaseD() {
+ runTest("cased");
+ }
+
+ // multiple instances causing factory invocation multiple times (but is cached)
+ public void testCaseE() {
+ runTest("casee");
+ }
+
+ // Factory method directly takes the type specified in the Mixin target (strongly typed)
+ public void testCaseF() {
+ runTest("casef");
+ }
+
+ // targeting multiple types from the Mixin
+ public void testCaseG() {
+ runTest("caseg");
+ }
+
+ // Null value for mixin target pattern
+ public void testCaseH() {
+ runTest("caseh");
+ }
+
+ // Invalid interfaces annotation value entries
+ public void testCaseI() {
+ runTest("casei");
}
// --
<suite>
- <ajc-test dir="features164/declareMixin" title="simple scenario">
+ <ajc-test dir="features164/declareMixin" title="casea">
<compile files="CaseA.java" options="-1.5"/>
- <run class="CaseA"/>
+ <run class="CaseA">
+ <stdout>
+ <line text="Delegate factory invoked"/>
+ <line text="methodOne running"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="caseb">
+ <compile files="CaseB.java" options="-1.5"/>
+ <run class="CaseB">
+ <stdout>
+ <line text="Delegate factory invoked"/>
+ <line text="methodOne running"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="casec">
+ <compile files="CaseC.java" options="-1.5"/>
+ <run class="CaseC">
+ <stdout>
+ <line text="Delegate factory invoked for CaseC instance"/>
+ <line text="methodOne running"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="cased">
+ <compile files="CaseD.java" options="-1.5"/>
+ <run class="CaseD">
+ <stdout>
+ <line text="Delegate factory invoked for CaseD instance"/>
+ <line text="methodOne running"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="casee">
+ <compile files="CaseE.java" options="-1.5"/>
+ <run class="CaseE">
+ <stdout>
+ <line text="Delegate factory invoked for CaseE instance: a"/>
+ <line text="methodOne running on CaseE instance: a"/>
+ <line text="Delegate factory invoked for CaseE instance: b"/>
+ <line text="methodTwo running on CaseE instance: b"/>
+ <line text="methodOne running on CaseE instance: a"/>
+ <line text="methodTwo running on CaseE instance: b"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="casef">
+ <compile files="CaseF.java" options="-1.5"/>
+ <run class="CaseF">
+ <stdout>
+ <line text="Delegate factory invoked for CaseF instance"/>
+ <line text="methodOne running"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="caseg">
+ <compile files="CaseG.java" options="-1.5"/>
+ <run class="CaseG">
+ <stdout>
+ <line text="Delegate factory invoked for instance of A"/>
+ <line text="run() executing on behalf of A"/>
+ <line text="Delegate factory invoked for instance of B"/>
+ <line text="run() executing on behalf of B"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="caseh">
+ <compile files="CaseH.java" options="-1.5">
+ <message kind="error" text="The value for annotation attribute DeclareMixin"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="casei">
+ <compile files="CaseI.java" options="-1.5">
+ <message kind="error" text="Types listed in the 'interfaces'"/>
+ </compile>
</ajc-test>
</suite>
\ No newline at end of file