Skip to content

Instantly share code, notes, and snippets.

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())
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 |
<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>
@Configuration
@ComponentScan(
// basePackageClasses = [Recommendation::class],
includeFilters = [ComponentScan.Filter(type = FilterType.ANNOTATION, value = [DomainService::class, Stub::class])])
class DomainConfiguration
/**
* <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>
*/
import java.lang.annotation.Inherited
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
@Inherited
annotation class DomainService
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
@Inherited
@beyondxscratch
beyondxscratch / BoilerplateConfiguration.java
Last active July 27, 2019 22:03
Example of a boilerplate bean factory
@Configuration
public class DomainConfiguration {
@Bean
public RetrieveSanitaryGrades retrieveSanitaryGrades() {
return new RetrieveSanitaryGrades();
}
@Bean
public SearchRestaurants restaurantsFinder(Restaurants restaurants,
Select * from users where username='' OR '1'='1' LIMIT 1 --' and password=''
jdbcTemplate
.queryForObject(
"Select * from users where username='" + name + "' and password='" + password + "'",
BeanPropertyRowMapper.newInstance(DBUser.class));
Feature: Profile endpoint
Scenario: creating a profile
Given path 'profiles'
And request
"""
{ "topics": [{"name": "DDD"},{"name": "Hexagonal Architecture"}],"talksFormats": ["QUICKIE","CONFERENCE"] }
"""
When method post
Then assert responseStatus == 201