MethodSynthesizerProxy implements MethodSynthesizer { MethodSynthesizer getSynthesizer() { return synthesizer; } MethodSynthesizerProxy(final ClassLoader classLoader);  MethodSynthesizerProxy(final ClassLoader classLoader, final Object value); DataReader synthesizeReader(final PropertyDescriptor descriptor); DataWriter synthesizeWriter(final PropertyDescriptor descriptor); boolean configure(final String configuration, final Object value); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); void releaseResources();  }
@Test public void testJavassistConfigConstructor() throws GeDAException { final MethodSynthesizerProxy proxy = new MethodSynthesizerProxy(this.getClass().getClassLoader(), "javassist"); final MethodSynthesizer syn = proxy.getSynthesizer(); assertTrue(syn instanceof JavassistMethodSynthesizer); }
@Test public void testReflectionConfigConstructor() throws GeDAException { final MethodSynthesizerProxy proxy = new MethodSynthesizerProxy(this.getClass().getClassLoader(), "reflection"); final MethodSynthesizer syn = proxy.getSynthesizer(); assertTrue(syn instanceof ReflectionMethodSynthesizer); }
@Test public void testCGLibConfigConstructor() throws GeDAException { final MethodSynthesizerProxy proxy = new MethodSynthesizerProxy(this.getClass().getClassLoader(), "bcel"); final MethodSynthesizer syn = proxy.getSynthesizer(); assertTrue(syn instanceof BCELMethodSynthesizer); }
@Test public void testClassnameConfigConstructor() throws GeDAException { final MethodSynthesizerProxy proxy = new MethodSynthesizerProxy(this.getClass().getClassLoader(), JavassistMethodSynthesizer.class.getCanonicalName()); final MethodSynthesizer syn = proxy.getSynthesizer(); assertTrue(syn instanceof JavassistMethodSynthesizer); }
@Test public void testInstanceConfigConstructor() throws GeDAException { final MethodSynthesizer mock = new MethodSynthesizer() { public DataReader synthesizeReader(final PropertyDescriptor descriptor) throws InspectionPropertyNotFoundException, UnableToCreateInstanceException, GeDARuntimeException { return null; } public DataWriter synthesizeWriter(final PropertyDescriptor descriptor) throws InspectionPropertyNotFoundException, UnableToCreateInstanceException, GeDARuntimeException { return null; } public boolean configure(final String configuration, final Object value) { return false; } public void releaseResources() { } }; final MethodSynthesizerProxy proxy = new MethodSynthesizerProxy(this.getClass().getClassLoader(), mock); final MethodSynthesizer syn = proxy.getSynthesizer(); assertSame(syn, mock); }
@Test(expected = UnableToCreateInstanceException.class) public void testWrongConfigConstructorThrowsException() throws GeDAException { final MethodSynthesizerProxy proxy = new MethodSynthesizerProxy(this.getClass().getClassLoader(), new Integer(1)); final MethodSynthesizer syn = proxy.getSynthesizer(); assertTrue(syn instanceof JavassistMethodSynthesizer); }