/** * Creates an {@link Ordering} from the given factory. * * @param factory factory to use to create the ordering * @param annotatedTestClass test class that is annotated with {@link OrderWith}. * @throws InvalidOrderingException if the instance could not be created */ public static Ordering definedBy( Ordering.Factory factory, Description annotatedTestClass) throws InvalidOrderingException { if (factory == null) { throw new NullPointerException("factory cannot be null"); } if (annotatedTestClass == null) { throw new NullPointerException("annotatedTestClass cannot be null"); } return factory.create(new Ordering.Context(annotatedTestClass)); }