### Question:
QoSProcessor implements ExecutionPreProcessor { @Override public InterceptorResult invoke(ExecutionContext ctx, OperationKey key, Object[] args) { if (trigger.getStatus().ordinal() >= triggeringStatus.ordinal()) { return processor.invoke(ctx, key, args); } return new InterceptorResult(InterceptorState.CONTINUE); } QoSProcessor(StatusSource trigger, Status triggeringStatus, ExecutionPreProcessor processor); @Override ExecutionRequirement getExecutionRequirement(); @Override InterceptorResult invoke(ExecutionContext ctx, OperationKey key, Object[] args); @Override String getName();  }### Answer:
@Test public void equalStatusTriggers() { QoSProcessor processor = new QoSProcessor(trigger, Status.OK, wrappedProcessor); when(trigger.getStatus()).thenReturn(Status.OK); processor.invoke(null, null, null); verify(wrappedProcessor, times(1)).invoke(any(ExecutionContext.class), any(OperationKey.class), any(Object[].class)); }
@Test public void worseStatusTriggers() { QoSProcessor processor = new QoSProcessor(trigger, Status.WARN, wrappedProcessor); when(trigger.getStatus()).thenReturn(Status.FAIL); processor.invoke(null, null, null); verify(wrappedProcessor, times(1)).invoke(any(ExecutionContext.class), any(OperationKey.class), any(Object[].class)); }
@Test public void betterStatusDoesntTrigger() { QoSProcessor processor = new QoSProcessor(trigger, Status.WARN, wrappedProcessor); when(trigger.getStatus()).thenReturn(Status.OK); processor.invoke(null, null, null); verify(wrappedProcessor, times(0)).invoke(any(ExecutionContext.class), any(OperationKey.class), any(Object[].class)); }