// Path: warehouse-model/src/main/java/warehouse/BoxLabel.java
// @Value
// public class BoxLabel {
//     private final String refNo;
//     private final int quantity;
//     private final String boxType;
// }
// 
// Path: warehouse-model/src/main/java/warehouse/PaletteLabel.java
// @Value
// public class PaletteLabel {
//     private final String id;
//     private final String refNo;
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }


import org.assertj.core.api.Assertions;
import org.junit.Test;
import warehouse.BoxLabel;
import warehouse.PaletteLabel;
import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;

    @Test
    public void someProductMissingSomeProductNotExpected() throws Exception {
        requiredProductsInCart("900901", "900902", "900903", "900904");
        RegisterNew command = givenCartRegistrationCommand("9009XXXX", "900902", "900903", "900904");

        ValidationResult result = validator.validate(command);

        Assertions.assertThat(result.getViolations())
                .contains(
                        "not expected refNo 9009XXXX",
                        "refNo 900901 expected in pocket 1, but not found");
    }

    @Test
    public void someProductExpectedInOtherPocket() throws Exception {
        requiredProductsInCart("900901", "900902", "900903", "900904");
        RegisterNew command = givenCartRegistrationCommand("900902", "900901", "900903", "900904");

        ValidationResult result = validator.validate(command);

        Assertions.assertThat(result.getViolations())
                .contains(
                        "refNo 900901 expected in pocket 1, but found in 2",
                        "refNo 900902 expected in pocket 2, but found in 1");

    }

    private RegisterNew givenCartRegistrationCommand(String... labels) {
        return new RegisterNew(cartLabel, Stream.of(labels)
// Path: warehouse-model/src/main/java/warehouse/BoxLabel.java
// @Value
// public class BoxLabel {
//     private final String refNo;
//     private final int quantity;
//     private final String boxType;
// }
// 
// Path: warehouse-model/src/main/java/warehouse/PaletteLabel.java
// @Value
// public class PaletteLabel {
//     private final String id;
//     private final String refNo;
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }


// Path: warehouse-model/src/test/java/warehouse/products/CartValidatorTest.java
import org.assertj.core.api.Assertions;
import org.junit.Test;
import warehouse.BoxLabel;
import warehouse.PaletteLabel;
import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;


    @Test
    public void someProductMissingSomeProductNotExpected() throws Exception {
        requiredProductsInCart("900901", "900902", "900903", "900904");
        RegisterNew command = givenCartRegistrationCommand("9009XXXX", "900902", "900903", "900904");

        ValidationResult result = validator.validate(command);

        Assertions.assertThat(result.getViolations())
                .contains(
                        "not expected refNo 9009XXXX",
                        "refNo 900901 expected in pocket 1, but not found");
    }

    @Test
    public void someProductExpectedInOtherPocket() throws Exception {
        requiredProductsInCart("900901", "900902", "900903", "900904");
        RegisterNew command = givenCartRegistrationCommand("900902", "900901", "900903", "900904");

        ValidationResult result = validator.validate(command);

        Assertions.assertThat(result.getViolations())
                .contains(
                        "refNo 900901 expected in pocket 1, but found in 2",
                        "refNo 900902 expected in pocket 2, but found in 1");

    }

    private RegisterNew givenCartRegistrationCommand(String... labels) {
        return new RegisterNew(cartLabel, Stream.of(labels)
                .map(l -> new BoxLabel(l, 1, "POCKET"))