ifs-security/src/test/java/org/innovateuk/ifs/commons/AbstractServiceSecurityAnnotationsTest.java
/**
     * Test that all classes and methods that should have security annotations have them.
     *
     * @throws Exception
     */
Test that all classes and methods that should have security annotations have them.
@throws Exception
Test that all classes and methods that should have security annotations have them . @throws Exception
@Test
    public void testServiceMethodsHaveSecurityAnnotations() throws Exception {
        Collection<Object> services = servicesToTest();
        assertNotNull(services);
        assertFalse(services.isEmpty());
        List<Method> notSecured = new ArrayList<>();
        for (Object service : services) {
            if (!isSecuredAtClassLevel(service)) {
                notSecured.addAll(notSecuredAtMethodLevel(service));
            }
        }
        if (!notSecured.isEmpty()) {
            fail(methodFailureMessage("The following methods need to have a security annotation, or one needs to be added at class level", notSecured));
        }
    }
@ Test public void testServiceMethodsHaveSecurityAnnotations ( ) throws Exception { Collection < Object > services = servicesToTest ( ) ; assertNotNull ( services ) ; assertFalse ( services . isEmpty ( ) ) ; List < Method > notSecured = new ArrayList < > ( ) ; for ( Object service : services ) { if ( ! isSecuredAtClassLevel ( service ) ) { notSecured . addAll ( notSecuredAtMethodLevel ( service ) ) ; } } if ( ! notSecured . isEmpty ( ) ) { fail ( methodFailureMessage ( "The following methods need to have a security annotation, or one needs to be added at class level" , notSecured ) ) ; } }
Test that all classes and methods that should have security annotations have them.
Test that all classes and methods that should have security annotations have them .
// Assert that we actually have some services. // If we are secured at the class level it is not necessary to be secured at the method level. // We are not secured at the class level check at method level.