@Test public void testEmpty() throws Throwable { assertEquals(0, nop.getCount()); proxied.getName(); proxied.setName(""); proxied.echo(null); assertEquals(0, nop.getCount()); }
@Test public void testSets() throws Throwable { pc.setMappedNames(new String[] {"set*", "echo"}); assertEquals(0, nop.getCount()); proxied.getName(); proxied.setName(""); assertEquals(1, nop.getCount()); proxied.echo(null); assertEquals(2, nop.getCount()); }
@Test public void testSerializable() throws Throwable { testSets(); // Count is now 2 Person p2 = (Person) SerializationTestUtils.serializeAndDeserialize(proxied); NopInterceptor nop2 = (NopInterceptor) ((Advised) p2).getAdvisors()[0].getAdvice(); p2.getName(); assertEquals(2, nop2.getCount()); p2.echo(null); assertEquals(3, nop2.getCount()); }
@Test public void testMatchOneMethod() throws Throwable { pc.addMethodName("echo"); pc.addMethodName("set*"); assertEquals(0, nop.getCount()); proxied.getName(); proxied.getName(); assertEquals(0, nop.getCount()); proxied.echo(null); assertEquals(1, nop.getCount()); proxied.setName(""); assertEquals(2, nop.getCount()); proxied.setAge(25); assertEquals(25, proxied.getAge()); assertEquals(3, nop.getCount()); }