@Test public void testGetParameterConstraintsForParameterlessMethod() { MethodDescriptor methodDescriptor = getMethodDescriptor(CustomerRepositoryExt.class, "baz"); List<ParameterDescriptor> parameterConstraints = methodDescriptor.getParameterConstraints(); assertNotNull(parameterConstraints); assertEquals(parameterConstraints.size(), 0); }
@Test public void testGetParameterConstraints() { MethodDescriptor methodDescriptor = getMethodDescriptor( CustomerRepositoryExt.class, "createCustomer", CharSequence.class, String.class); List<ParameterDescriptor> parameterConstraints = methodDescriptor.getParameterConstraints(); assertNotNull(parameterConstraints); assertEquals(parameterConstraints.size(), 2); ParameterDescriptor parameterDescriptor1 = parameterConstraints.get(0); assertEquals(parameterDescriptor1.getElementClass(), CharSequence.class); assertFalse(parameterDescriptor1.hasConstraints()); ParameterDescriptor parameterDescriptor2 = parameterConstraints.get(1); assertEquals(parameterDescriptor2.getElementClass(), String.class); assertTrue(parameterDescriptor2.hasConstraints()); }