This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* <p> | |
* A DDD aggregate is a cluster of domain objects that is treated as a | |
* single unit to ensure consistency across them. | |
* </p> | |
* | |
* @see <a href= "https://martinfowler.com/bliki/DDD_Aggregate.html"> | |
* Aggregates in Domain Driven Design | |
* </a> | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@ComponentScan( | |
// basePackageClasses = [Recommendation::class], | |
includeFilters = [ComponentScan.Filter(type = FilterType.ANNOTATION, value = [DomainService::class, Stub::class])]) | |
class DomainConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<artifactId>kotlin-maven-plugin</artifactId> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<configuration> | |
<compilerPlugins> | |
<plugin>all-open</plugin> | |
</compilerPlugins> | |
<pluginOptions> | |
<option>all-open:annotation=org.craftsrecords.hexarch.DomainService</option> | |
<option>all-open:annotation=org.craftsrecords.hexarch.Stub</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: As a frequent user, | |
In order not repeat my preferences at each request, | |
I want to create my profile with my preferences | |
Scenario: The user is creating his profile with his preferences | |
Given a user | |
And he wants to learn | |
| DDD | hexagonal architecture | | |
And he only wants to see | |
| QUICKIE | CONFERENCE | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.craftsrecords.talkadvisor.recommendation.api.CreateProfile | |
import org.craftsrecords.talkadvisor.recommendation.spi.Profiles | |
class ProfileStepdefs(private val testContext: TestContext, | |
private val createProfile: CreateProfile, | |
private val profiles: Profiles) { | |
@Given("^he already has a profile$") | |
fun `he already has a profile`() { | |
val profile = Profile(testContext.userId, createPreferences()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomPicoFactory : PicoFactory() { | |
init { | |
addClass(TestContext::class.java) | |
addClass(TalksAdvisor::class.java) | |
addClass(HardCodedTalksSearcher::class.java) | |
addClass(InMemoryRecommendations::class.java) | |
addClass(ProfileCreator::class.java) | |
addClass(InMemoryProfiles::class.java) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cucumber.api.java.ObjectFactory=org.craftsrecords.talkadvisor.CustomPicoFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(Cucumber::class) | |
@CucumberOptions(strict = true, plugin = ["pretty", "json:target/cucumber/recommendation.json"], features = ["classpath:features/recommending-talks.feature"]) | |
class RecommendationFunctionalTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<properties> | |
<cucumber.version>4.2.3</cucumber.version> | |
<assertj-core.version>3.11.1</assertj-core.version> | |
</properties> | |
... | |
<dependency> | |
<groupId>io.cucumber</groupId> | |
<artifactId>cucumber-picocontainer</artifactId> | |
<version>${cucumber.version}</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Talk is related to the topic | |
assertThat(talk.title).contains("topic") | |
//All recommended talks are related to the topic | |
assertThat(recommendation.talks.map { it.title }).allMatch{ it.contains("topic") } |