From af2f7e79a58a600e57105eea7458ac846673e08d Mon Sep 17 00:00:00 2001 From: Jacek Milewski Date: Fri, 29 Dec 2023 17:15:56 +0100 Subject: [PATCH] task-unit-done --- .../com/bottega/promoter/concert/domain/Concert.java | 3 ++- .../concert/domain/Concert_initConcert_unitSpec.groovy | 6 +++++- .../concert/domain/Concert_initConcert_unitTest.java | 10 ++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/services/Promoter/src/main/java/com/bottega/promoter/concert/domain/Concert.java b/services/Promoter/src/main/java/com/bottega/promoter/concert/domain/Concert.java index 03f1b878..f98b58ad 100644 --- a/services/Promoter/src/main/java/com/bottega/promoter/concert/domain/Concert.java +++ b/services/Promoter/src/main/java/com/bottega/promoter/concert/domain/Concert.java @@ -1,6 +1,6 @@ package com.bottega.promoter.concert.domain; -import java.util.*; +import java.util.Set; import com.bottega.promoter.agreements.PromoterId; import com.bottega.sharedlib.ddd.AggregateRoot; @@ -54,6 +54,7 @@ public PromoterId promoterId() { public void initNewConcert(TagService tagService, CategoryService categoryService) { + tags = tagService.tag(title); category = categoryService.categorize(title); } diff --git a/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/Concert_initConcert_unitSpec.groovy b/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/Concert_initConcert_unitSpec.groovy index a5feb3f2..c12fd48d 100644 --- a/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/Concert_initConcert_unitSpec.groovy +++ b/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/Concert_initConcert_unitSpec.groovy @@ -1,5 +1,6 @@ package com.bottega.promoter.concert.domain + import com.bottega.promoter.fixtures.SpecificationBase import static com.bottega.sharedlib.config.TestClockConfig.TEST_TIME_PLUS_30_DAYS @@ -22,7 +23,10 @@ class Concert_initConcert_unitSpec extends SpecificationBase { where: title | expectedTags "no tags apply" | [] - //TODO more cases + "Rock concert" | ["rock"] + "Scorpions in Warsaw!" | ["rock"] + "Scorpions on Mystic Festival" | ["rock", "festival"] + "Rihanna the best of" | ["pop"] } def "initConcert - assigns category"() { diff --git a/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/Concert_initConcert_unitTest.java b/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/Concert_initConcert_unitTest.java index 513574b7..8e0f21c2 100644 --- a/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/Concert_initConcert_unitTest.java +++ b/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/Concert_initConcert_unitTest.java @@ -4,8 +4,6 @@ import java.util.stream.Stream; import com.bottega.promoter.concert.fixtures.ConcertLogicTestBase; -import com.bottega.sharedlib.config.TestClockConfig; -import org.junit.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.*; import static com.bottega.sharedlib.config.TestClockConfig.TEST_TIME_PLUS_30_DAYS; @@ -14,10 +12,14 @@ class Concert_initConcert_unitTest extends ConcertLogicTestBase { + private static Stream provideStringsForTags() { return Stream.of( - Arguments.of("no tags apply", Set.of()) - //TODO more cases + Arguments.of("no tags apply", Set.of()), + Arguments.of("Rock concert", Set.of("rock")), + Arguments.of("Scorpions in Warsaw!", Set.of("rock")), + Arguments.of("Scorpions on Mystic Festival", Set.of("rock", "festival")), + Arguments.of("Rihanna the best of", Set.of("pop")) ); }