package com.thoughtworks.acceptance;

import com.thoughtworks.acceptance.objects.SampleDynamicProxy;

public class DynamicProxyTest extends AbstractAcceptanceTest {

    public void testDynamicProxy() {
        assertBothWays(SampleDynamicProxy.newInstance(),
                "<dynamic-proxy>\n" +
                "  <interface>com.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceOne</interface>\n" +
                "  <interface>com.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceTwo</interface>\n" +
                "  <handler class=\"com.thoughtworks.acceptance.objects.SampleDynamicProxy\">\n" +
                "    <aField>hello</aField>\n" +
                "  </handler>\n" +
                "</dynamic-proxy>");
    }

}

@@ -95,16 +95,17 @@
 Proxy;%0A%0A
+%0A
 public c
@@ -158,16 +158,160 @@
 ceTest %7B
+%0A    public static class ClassWithProxyMember %7B%0A        SampleDynamicProxy.InterfaceOne one;%0A        SampleDynamicProxy.InterfaceTwo two;%0A    %7D;
 %0A%0A    pu
@@ -397,16 +397,19 @@
 tance(),
+ %22%22
 %0A       
@@ -416,16 +416,18 @@
         
+ +
  %22%3Cdynam
@@ -434,26 +434,24 @@
 ic-proxy%3E%5Cn%22
- +
 %0A           
@@ -446,32 +446,34 @@
 %0A               
+ +
  %22  %3Cinterface%3Ec
@@ -545,34 +545,32 @@
 e%3C/interface%3E%5Cn%22
- +
 %0A               
@@ -565,24 +565,26 @@
             
+ +
  %22  %3Cinterfa
@@ -664,26 +664,123 @@
 nterface%3E%5Cn%22
- +
+%0A                + %22  %3Chandler class=%5C%22com.thoughtworks.acceptance.objects.SampleDynamicProxy%5C%22%3E%5Cn%22
 %0A           
@@ -783,20 +783,860 @@
         
+ +
  %22  
+  %3CaField%3Ehello%3C/aField%3E%5Cn%22%0A                + %22  %3C/handler%3E%5Cn%22%0A                + %22%3C/dynamic-proxy%3E%22);%0A    %7D%0A%0A    public void TODOtestDynamicProxyAsFieldMember() %7B%0A        ClassWithProxyMember expected = new ClassWithProxyMember();%0A        expected.one = (SampleDynamicProxy.InterfaceOne)SampleDynamicProxy.newInstance();%0A        expected.two = (SampleDynamicProxy.InterfaceTwo)expected.one;%0A        xstream.alias(%22with-proxy%22, ClassWithProxyMember.class);%0A        assertBothWays(expected, %22%22%0A                + %22%3Cwith-proxy%3E%5Cn%22%0A                + %22  %3Cone class=%5C%22dynamic-proxy%5C%22%3E%5Cn%22%0A                + %22    %3Cinterface%3Ecom.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceOne%3C/interface%3E%5Cn%22%0A                + %22    %3Cinterface%3Ecom.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceTwo%3C/interface%3E%5Cn%22%0A                + %22    
 %3Chandler
@@ -1700,26 +1700,24 @@
 cProxy%5C%22%3E%5Cn%22
- +
 %0A           
@@ -1721,21 +1721,25 @@
         
-%22
++ %22 
     
+ 
 %3CaField%3E
@@ -1751,26 +1751,24 @@
 %3C/aField%3E%5Cn%22
- +
 %0A           
@@ -1771,18 +1771,22 @@
         
+ +
  %22
+  
   %3C/hand
@@ -1796,37 +1796,141 @@
 %3E%5Cn%22
- +%0A                %22%3C/dynamic
+%0A                + %22  %3C/one%3E%5Cn%22%0A                + %22  %3Ctwo class=%5C%22dynamic-proxy%5C%22 reference=%5C%22../one%5C%22/%3E%5Cn%22%0A                + %22%3C/with
 -pro

Add test case for proxy bug.