Search in sources :

Example 11 with Recipe

use of uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe in project microservice_framework by CJSCommonPlatform.

the class RecipeRepositoryTest method shouldReturnNullIfRecipeNotFound.

@Test
public void shouldReturnNullIfRecipeNotFound() {
    Recipe recipe = recipeRepository.findBy(UUID.randomUUID());
    assertThat(recipe, is(nullValue()));
}
Also used : Recipe(uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe) Test(org.junit.Test) BaseTransactionalTest(uk.gov.justice.services.test.utils.persistence.BaseTransactionalTest)

Example 12 with Recipe

use of uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe 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

Recipe (uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe)12 Test (org.junit.Test)8 Handles (uk.gov.justice.services.core.annotation.Handles)3 RecipeView (uk.gov.justice.services.example.cakeshop.query.view.response.RecipeView)3 RecipesView (uk.gov.justice.services.example.cakeshop.query.view.response.RecipesView)2 BaseTransactionalTest (uk.gov.justice.services.test.utils.persistence.BaseTransactionalTest)2 UUID (java.util.UUID)1 Ingredient (uk.gov.justice.services.example.cakeshop.domain.Ingredient)1 RecipeAdded (uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded)1 PhotoView (uk.gov.justice.services.example.cakeshop.query.view.response.PhotoView)1