private Collection < FrameworkMethod > filterAndSort ( List < FrameworkMethod > fms , boolean isStatic ) throws Exception { SortedMap < Integer , FrameworkMethod > m = new TreeMap <> ( ) ; for ( FrameworkMethod fm : fms ) { SecurityActions . setAccessible ( fm . getMethod ( ) ) ; if ( Modifier . isStatic ( fm . getMethod ( ) . getModifiers ( ) ) == isStatic ) { Deployment deployment = ( Deployment ) fm . getAnnotation ( Deployment . class ) ; int order = deployment . order ( ) ; if ( order <= 0 || m . containsKey ( Integer . valueOf ( order ) ) ) throw new Exception ( "Incorrect order definition '" + order + "' on " + fm . getDeclaringClass ( ) . getName ( ) + "#" + fm . getName ( ) ) ; m . put ( Integer . valueOf ( order ) , fm ) ; } } return m . values ( ) ; }
Filter and sort