Search in sources :

Example 6 with RecipeAdded

use of uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded in project microservice_framework by CJSCommonPlatform.

the class RecipeCommandHandlerTest method existingRecipe.

private Recipe existingRecipe() {
    final Recipe recipe = new Recipe();
    recipe.apply(new RecipeAdded(RECIPE_ID, RECIPE_NAME, GULTEN_FREE, emptyList()));
    return recipe;
}
Also used : RecipeAdded(uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded) Recipe(uk.gov.justice.services.example.cakeshop.domain.aggregate.Recipe)

Example 7 with RecipeAdded

use of uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded in project microservice_framework by CJSCommonPlatform.

the class RecipeAddedToRecipeConverterTest method shouldConvertRecipeAddedEvent.

@Test
public void shouldConvertRecipeAddedEvent() {
    final String name = "someName123";
    final UUID recipeId = UUID.randomUUID();
    final boolean glutenFree = true;
    final List<Ingredient> ingredients = Collections.singletonList(new Ingredient("sugar", 2));
    Recipe recipe = converter.convert(new RecipeAdded(recipeId, name, glutenFree, ingredients));
    assertThat(recipe.getName(), equalTo(name));
    assertThat(recipe.getId(), equalTo(recipeId));
    assertThat(recipe.isGlutenFree(), equalTo(glutenFree));
}
Also used : RecipeAdded(uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded) Ingredient(uk.gov.justice.services.example.cakeshop.domain.Ingredient) Recipe(uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

RecipeAdded (uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded)7 Test (org.junit.Test)4 Handles (uk.gov.justice.services.core.annotation.Handles)2 Recipe (uk.gov.justice.services.example.cakeshop.domain.aggregate.Recipe)2 Ingredient (uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient)2 UUID (java.util.UUID)1 Ingredient (uk.gov.justice.services.example.cakeshop.domain.Ingredient)1 Recipe (uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe)1 JsonEnvelope (uk.gov.justice.services.messaging.JsonEnvelope)1