// Path: myeslib-core/src/main/java/org/myeslib/core/Event.java
// public interface Event extends Serializable {
// 	
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @AllArgsConstructor
// public static class CreateCommandHandler implements CommandHandler<CreateInventoryItem> {
// 
//     @Delegate @NonNull
//     final InventoryItemAggregateRoot aggregateRoot;
//     @NonNull
//     final ItemDescriptionGeneratorService service;
// 
//     public List<? extends Event> handle(CreateInventoryItem command) {
//         checkArgument(getId() == null, "item already exists");
//         checkNotNull(service);
//         String description = service.generate(command.getId());
//         InventoryItemCreated event = new InventoryItemCreated(command.getId(), description);
//         return Arrays.asList(event);
//     }
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class CreateInventoryItem implements Command {
//     @NonNull
//     UUID commandId;
//     @NonNull
//     UUID id;
//     Long targetVersion = 0L;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @AllArgsConstructor
// public static class DecreaseCommandHandler implements CommandHandler<DecreaseInventory> {
// 
//     @Delegate @NonNull
//     final InventoryItemAggregateRoot aggregateRoot;
// 
//     public List<? extends Event> handle(DecreaseInventory command) {
//         checkArgument(getId() != null, "before decreasing you must create an item");
//         checkArgument(getId().equals(command.getId()), "item id does not match");
//         checkArgument(isAvailable(command.howMany), "there are not enough items available");
//         InventoryDecreased event = new InventoryDecreased(command.getId(), command.getHowMany());
//         return Arrays.asList(event);
//     }
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class DecreaseInventory implements Command {
//     @NonNull
//     UUID commandId;
//     @NonNull
//     UUID id;
//     @NonNull
//     Integer howMany;
//     Long targetVersion;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @AllArgsConstructor
// public static class IncreaseCommandHandler implements CommandHandler<IncreaseInventory> {
// 
//     @Delegate @NonNull
//     final InventoryItemAggregateRoot aggregateRoot;
// 
//     public List<? extends Event> handle(IncreaseInventory command) {
//         checkArgument(getId() != null, "before increasing you must create an item");
//         checkArgument(getId().equals(command.getId()), "item id does not match");
//         InventoryIncreased event = new InventoryIncreased(command.getId(), command.getHowMany());
//         return Arrays.asList(event);
//     }
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class IncreaseInventory implements Command {
//     @NonNull
//     UUID commandId;
//     @NonNull
//     UUID id;
//     @NonNull
//     Integer howMany;
//     Long targetVersion;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class InventoryDecreased implements Event {
//     @NonNull
//     UUID id;
//     @NonNull
//     Integer howMany;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class InventoryIncreased implements Event {
//     @NonNull
//     UUID id;
//     @NonNull
//     Integer howMany;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Data
// public static class InventoryItemAggregateRoot implements AggregateRoot {
// 
//     UUID id;
//     String description;
//     Integer available = 0;
// 
//     public void on(InventoryItemCreated event) {
//         this.id = event.id;
//         this.description = event.description;
//         this.available = 0;
//     }
// 
//     public void on(InventoryIncreased event) {
//         this.available = this.available + event.howMany;
//     }
// 
//     public void on(InventoryDecreased event) {
//         this.available = this.available - event.howMany;
//     }
//         
//     public boolean isAvailable(int howMany) {
//         return getAvailable() - howMany >= 0;
//     }
// 
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class InventoryItemCreated implements Event {
//     @NonNull
//     UUID id;
//     @NonNull
//     String description;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// public static interface ItemDescriptionGeneratorService {
//     String generate(UUID id);
// }


import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.List;
import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.myeslib.core.Event;
import org.myeslib.example.SampleDomain.CreateCommandHandler;
import org.myeslib.example.SampleDomain.CreateInventoryItem;
import org.myeslib.example.SampleDomain.DecreaseCommandHandler;
import org.myeslib.example.SampleDomain.DecreaseInventory;
import org.myeslib.example.SampleDomain.IncreaseCommandHandler;
import org.myeslib.example.SampleDomain.IncreaseInventory;
import org.myeslib.example.SampleDomain.InventoryDecreased;
import org.myeslib.example.SampleDomain.InventoryIncreased;
import org.myeslib.example.SampleDomain.InventoryItemAggregateRoot;
import org.myeslib.example.SampleDomain.InventoryItemCreated;
import org.myeslib.example.SampleDomain.ItemDescriptionGeneratorService;
package org.myeslib.example;




@RunWith(MockitoJUnitRunner.class)
public class InventoryItemCommandHandlerTest {

	@Mock
// Path: myeslib-core/src/main/java/org/myeslib/core/Event.java
// public interface Event extends Serializable {
// 	
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @AllArgsConstructor
// public static class CreateCommandHandler implements CommandHandler<CreateInventoryItem> {
// 
//     @Delegate @NonNull
//     final InventoryItemAggregateRoot aggregateRoot;
//     @NonNull
//     final ItemDescriptionGeneratorService service;
// 
//     public List<? extends Event> handle(CreateInventoryItem command) {
//         checkArgument(getId() == null, "item already exists");
//         checkNotNull(service);
//         String description = service.generate(command.getId());
//         InventoryItemCreated event = new InventoryItemCreated(command.getId(), description);
//         return Arrays.asList(event);
//     }
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class CreateInventoryItem implements Command {
//     @NonNull
//     UUID commandId;
//     @NonNull
//     UUID id;
//     Long targetVersion = 0L;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @AllArgsConstructor
// public static class DecreaseCommandHandler implements CommandHandler<DecreaseInventory> {
// 
//     @Delegate @NonNull
//     final InventoryItemAggregateRoot aggregateRoot;
// 
//     public List<? extends Event> handle(DecreaseInventory command) {
//         checkArgument(getId() != null, "before decreasing you must create an item");
//         checkArgument(getId().equals(command.getId()), "item id does not match");
//         checkArgument(isAvailable(command.howMany), "there are not enough items available");
//         InventoryDecreased event = new InventoryDecreased(command.getId(), command.getHowMany());
//         return Arrays.asList(event);
//     }
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class DecreaseInventory implements Command {
//     @NonNull
//     UUID commandId;
//     @NonNull
//     UUID id;
//     @NonNull
//     Integer howMany;
//     Long targetVersion;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @AllArgsConstructor
// public static class IncreaseCommandHandler implements CommandHandler<IncreaseInventory> {
// 
//     @Delegate @NonNull
//     final InventoryItemAggregateRoot aggregateRoot;
// 
//     public List<? extends Event> handle(IncreaseInventory command) {
//         checkArgument(getId() != null, "before increasing you must create an item");
//         checkArgument(getId().equals(command.getId()), "item id does not match");
//         InventoryIncreased event = new InventoryIncreased(command.getId(), command.getHowMany());
//         return Arrays.asList(event);
//     }
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class IncreaseInventory implements Command {
//     @NonNull
//     UUID commandId;
//     @NonNull
//     UUID id;
//     @NonNull
//     Integer howMany;
//     Long targetVersion;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class InventoryDecreased implements Event {
//     @NonNull
//     UUID id;
//     @NonNull
//     Integer howMany;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class InventoryIncreased implements Event {
//     @NonNull
//     UUID id;
//     @NonNull
//     Integer howMany;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Data
// public static class InventoryItemAggregateRoot implements AggregateRoot {
// 
//     UUID id;
//     String description;
//     Integer available = 0;
// 
//     public void on(InventoryItemCreated event) {
//         this.id = event.id;
//         this.description = event.description;
//         this.available = 0;
//     }
// 
//     public void on(InventoryIncreased event) {
//         this.available = this.available + event.howMany;
//     }
// 
//     public void on(InventoryDecreased event) {
//         this.available = this.available - event.howMany;
//     }
//         
//     public boolean isAvailable(int howMany) {
//         return getAvailable() - howMany >= 0;
//     }
// 
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// @Value
// public static class InventoryItemCreated implements Event {
//     @NonNull
//     UUID id;
//     @NonNull
//     String description;
// }
// 
// Path: inventory-aggregate-root/src/main/java/org/myeslib/example/SampleDomain.java
// public static interface ItemDescriptionGeneratorService {
//     String generate(UUID id);
// }


// Path: inventory-aggregate-root/src/test/java/org/myeslib/example/InventoryItemCommandHandlerTest.java
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.List;
import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.myeslib.core.Event;
import org.myeslib.example.SampleDomain.CreateCommandHandler;
import org.myeslib.example.SampleDomain.CreateInventoryItem;
import org.myeslib.example.SampleDomain.DecreaseCommandHandler;
import org.myeslib.example.SampleDomain.DecreaseInventory;
import org.myeslib.example.SampleDomain.IncreaseCommandHandler;
import org.myeslib.example.SampleDomain.IncreaseInventory;
import org.myeslib.example.SampleDomain.InventoryDecreased;
import org.myeslib.example.SampleDomain.InventoryIncreased;
import org.myeslib.example.SampleDomain.InventoryItemAggregateRoot;
import org.myeslib.example.SampleDomain.InventoryItemCreated;
import org.myeslib.example.SampleDomain.ItemDescriptionGeneratorService;

package org.myeslib.example;




@RunWith(MockitoJUnitRunner.class)
public class InventoryItemCommandHandlerTest {

	@Mock
	ItemDescriptionGeneratorService uuidGeneratorService ;