@Test
public void shouldValidateWhetherOrderAmountExceedsFraudLimitOverWindow() throws Exception {

  //Given
  fraudService = new FraudService();
  orders = asList(
      new Order(id(0L), 0L, CREATED, UNDERPANTS, 3, 5.00d),
      new Order(id(1L), 0L, CREATED, JUMPERS, 1, 75.00d),
      new Order(id(2L), 1L, CREATED, JUMPERS, 1, 75.00d),
      new Order(id(3L), 1L, CREATED, JUMPERS, 1, 75.00d),
      new Order(id(4L), 1L, CREATED, JUMPERS, 50, 75.00d),    //Should fail as over limit
      new Order(id(5L), 2L, CREATED, UNDERPANTS, 10, 100.00d),//First should pass
      new Order(id(6L), 2L, CREATED, UNDERPANTS, 10, 100.00d),//Second should fail as rolling total by customer is over limit
      new Order(id(7L), 2L, CREATED, UNDERPANTS, 1, 5.00d)    //Third should fail as rolling total by customer is still over limit
  );
  sendOrders(orders);
  //When
  fraudService.start(CLUSTER.bootstrapServers());
  //Then there should be failures for the two orders that push customers over their limit.
  expected = asList(
      new OrderValidation(id(0L), FRAUD_CHECK, PASS),
      new OrderValidation(id(1L), FRAUD_CHECK, PASS),
      new OrderValidation(id(2L), FRAUD_CHECK, PASS),
      new OrderValidation(id(3L), FRAUD_CHECK, PASS),
      new OrderValidation(id(4L), FRAUD_CHECK, FAIL),
      new OrderValidation(id(5L), FRAUD_CHECK, PASS),
      new OrderValidation(id(6L), FRAUD_CHECK, FAIL),
      new OrderValidation(id(7L), FRAUD_CHECK, FAIL)
  );
  List<OrderValidation> read = read(Topics.ORDER_VALIDATIONS, 8, CLUSTER.bootstrapServers());
  assertThat(read).isEqualTo(expected);
}