@Test @SpecAssertion(section = Sections.CONSTRAINTMETADATA_ELEMENTDESCRIPTOR, id = "d") @SpecAssertion(section = Sections.CONSTRAINTMETADATA_EXECUTABLEDESCRIPTOR, id = "g") public void testFindConstraintsForMethod() { MethodDescriptor parameterConstrainedDescriptor = Executables.parameterConstrainedMethod(); assertTrue( parameterConstrainedDescriptor.findConstraints() .getConstraintDescriptors() .isEmpty(), "Should have no constraints" ); MethodDescriptor returnValueConstrainedDescriptor = Executables.returnValueConstrainedMethod(); assertTrue( returnValueConstrainedDescriptor.findConstraints() .getConstraintDescriptors() .isEmpty(), "Should have no constraints" ); MethodDescriptor crossParameterConstrainedDescriptor = Executables.crossParameterConstrainedMethod(); assertTrue( crossParameterConstrainedDescriptor.findConstraints() .getConstraintDescriptors() .isEmpty(), "Should have no constraints" ); }
@Test @SpecAssertion(section = Sections.CONSTRAINTMETADATA_ELEMENTDESCRIPTOR, id = "d") @SpecAssertion(section = Sections.CONSTRAINTMETADATA_ELEMENTDESCRIPTOR, id = "g") @SpecAssertion(section = Sections.CONSTRAINTMETADATA_EXECUTABLEDESCRIPTOR, id = "g") public void testFindConstraintsForMethodLookingAt() { MethodDescriptor crossParameterConstrainedDescriptor = Executables.methodOverridingCrossParameterConstrainedMethod(); assertEquals( crossParameterConstrainedDescriptor.findConstraints() .lookingAt( Scope.LOCAL_ELEMENT ) .getConstraintDescriptors() .size(), 0, "Should have no local constraints" ); assertTrue( crossParameterConstrainedDescriptor.findConstraints().lookingAt( Scope.HIERARCHY ) .getConstraintDescriptors() .isEmpty(), "Should have no hierarchy constraints" ); }
@Test @SpecAssertion(section = Sections.CONSTRAINTMETADATA_ELEMENTDESCRIPTOR, id = "d") @SpecAssertion(section = Sections.CONSTRAINTMETADATA_ELEMENTDESCRIPTOR, id = "g") @SpecAssertion(section = Sections.CONSTRAINTMETADATA_EXECUTABLEDESCRIPTOR, id = "g") public void testFindConstraintsForMethodDefinedOnSuperTypeLookingAt() { MethodDescriptor crossParameterConstrainedDescriptor = Executables.crossParameterConstrainedMethodFromSuperType(); assertEquals( crossParameterConstrainedDescriptor.findConstraints() .lookingAt( Scope.LOCAL_ELEMENT ) .getConstraintDescriptors() .size(), 0, "Should have no local constraints" ); assertTrue( crossParameterConstrainedDescriptor.findConstraints().lookingAt( Scope.HIERARCHY ) .getConstraintDescriptors() .isEmpty(), "Should have no hierarchy constraint" ); }