Example #1
0
 @Test
 public void upperProxy() {
   Hello hello = new HelloUppercase(new HelloTarget());
   assertThat(hello.sayHello("Toby"), is("HELLO TOBY"));
   assertThat(hello.sayHi("Toby"), is("HI TOBY"));
   assertThat(hello.sayThankYou("Toby"), is("THANK YOU TOBY"));
 }
Example #2
0
 @Test
 public void simpleProxy() {
   Hello hello = new HelloTarget();
   assertThat(hello.sayHello("Toby"), is("Hello Toby"));
   assertThat(hello.sayHi("Toby"), is("Hi Toby"));
   assertThat(hello.sayThankYou("Toby"), is("Thank You Toby"));
 }
Example #3
0
 @Test
 public void dynamicProxy() {
   Hello proxiedHello =
       (Hello)
           Proxy.newProxyInstance(
               getClass().getClassLoader(),
               new Class[] {Hello.class},
               new UppercaseHandler(new HelloTarget()));
   assertThat(proxiedHello.sayHello("Toby"), is("HELLO TOBY"));
   assertThat(proxiedHello.sayHi("Toby"), is("HI TOBY"));
   assertThat(proxiedHello.sayThankYou("Toby"), is("THANK YOU TOBY"));
 }
 @Test
 public void testSayHello_String() {
   assertTrue(hello.sayHello().equals("Hello"));
 }
Example #5
0
 @Test
 public final void test() {
   assertThat(Hello.sayHello(), is("Hello"));
 }