PayloadMethodEndpointAdapter extends AbstractMethodEndpointAdapter { @Override protected boolean supportsInternal(MethodEndpoint methodEndpoint) { Method method = methodEndpoint.getMethod(); return (Void.TYPE.isAssignableFrom(method.getReturnType()) || Source.class.isAssignableFrom(method.getReturnType())) && method.getParameterTypes().length == 1 && Source.class.isAssignableFrom(method.getParameterTypes()[0]); }    }
@Test public void testSupportedNoResponse() throws NoSuchMethodException { MethodEndpoint methodEndpoint = new MethodEndpoint(this, "noResponse", new Class[] { DOMSource.class }); Assert.assertTrue("Method unsupported", adapter.supportsInternal(methodEndpoint)); }
@Test public void testSupportedResponse() throws NoSuchMethodException { MethodEndpoint methodEndpoint = new MethodEndpoint(this, "response", new Class[] { StreamSource.class }); Assert.assertTrue("Method unsupported", adapter.supportsInternal(methodEndpoint)); }
@Test public void testUnsupportedMethodMultipleParams() throws NoSuchMethodException { Assert.assertFalse("Method supported", adapter.supportsInternal( new MethodEndpoint(this, "unsupportedMultipleParams", new Class[] { Source.class, Source.class }))); }
@Test public void testUnsupportedMethodWrongReturnType() throws NoSuchMethodException { Assert.assertFalse("Method supported", adapter.supportsInternal(new MethodEndpoint(this, "unsupportedWrongReturnType", new Class[] { Source.class }))); }
@Test public void testUnsupportedMethodWrongParam() throws NoSuchMethodException { Assert.assertFalse("Method supported", adapter.supportsInternal(new MethodEndpoint(this, "unsupportedWrongParam", new Class[] { String.class }))); }