StockOp { @Branch public ShipmentStatus checkShipment(Shipment shipment) { if (shipment.getShippedDateOption().isNull()) { return ShipmentStatus.NOT_SHIPPED; } if (shipment.getCostOption().isNull()) { return ShipmentStatus.COST_UNKNOWN; } return ShipmentStatus.COMPLETED; }  @Branch ShipmentStatus checkShipment(Shipment shipment); @CoGroup void cutoff(
            // 在庫は商品ごとにグルーピングして、さらに入荷順に並べる
            @Key(group = "ITEM_CODE", order = "PURCHASED_DATE ASC") List<Stock> stocks,
            // 注文も商品ごとにグルーピングして、さらに出荷順に並べる
            @Key(group = "ITEM_CODE", order = "SHIPPED_DATE ASC") List<Shipment> shipments,
            Result<Stock> newStocks,
            Result<Shipment> newShipments);  }
@Test public void testCheckShipment_notShipped() { StockOpImpl operator = new StockOpImpl(); Shipment shipment = new Shipment(); ShipmentStatus actual = operator.checkShipment(shipment); assertThat(actual, is(ShipmentStatus.NOT_SHIPPED)); }
@Test public void testCheckShipment_costUnKnown() { StockOpImpl operator = new StockOpImpl(); Shipment shipment = new Shipment(); shipment.setShippedDate(new DateTime()); ShipmentStatus actual = operator.checkShipment(shipment); assertThat(actual, is(ShipmentStatus.COST_UNKNOWN)); }
@Test public void testCheckShipment_shipped() { StockOpImpl operator = new StockOpImpl(); Shipment shipment = new Shipment(); shipment.setShippedDate(new DateTime()); shipment.setCost(100); ShipmentStatus actual = operator.checkShipment(shipment); assertThat(actual, is(ShipmentStatus.COMPLETED)); }