Skip to content

Fix test password_does_not_match and improve CI workflow #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
name: CI

on: [push]
on:
push:
branches:
- master
pull_request:

jobs:
build:

name: 🧑‍🔬 Test project
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: ⬇️ Checkout project
uses: actions/checkout@v2

- name: Start all the environment
- name: 🏁 Start all the environment
run: docker-compose up -d

- name: Wait for the environment to get up
- name: ⏱️ Wait for the environment to get up
run: |
while ! make ping-mysql &>/dev/null; do
echo "Waiting for database connection..."
sleep 2
done

- name: Run the tests
- name: 🧪 Run the tests
run: make test
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ allprojects {
implementation 'org.springframework.boot:spring-boot-starter-amqp'
implementation 'org.elasticsearch.client:elasticsearch-rest-client:6.8.5'
implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.8.4'
runtime 'mysql:mysql-connector-java:8.0.18'
runtimeOnly 'mysql:mysql-connector-java:8.0.18'

// Test
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
Expand Down Expand Up @@ -136,8 +136,8 @@ sourceSets {
apply plugin: 'application'

bootJar {
baseName = 'java-ddd-skeleton'
version = '0.0.1'
archiveBaseName = 'java-ddd-skeleton'
archiveVersion = '0.0.1'
}

mainClassName = 'tv.codely.apps.Starter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ void throw_an_exception_when_the_user_does_not_exist() {
}

@Test
void throw_an_exception_when_the_password_does_not_math() {
void throw_an_exception_when_the_password_does_not_match() {
assertThrows(InvalidAuthCredentials.class, () -> {
AuthenticateUserCommand command = AuthenticateUserCommandMother.random();
AuthUser authUser = AuthUserMother.withUsername(command.username());
AuthUser authUser = AuthUserMother.withUsernameAndPassword(command.username(),
command.password().concat("👎"));

shouldSearch(authUser.username(), authUser);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static AuthUser fromCommand(AuthenticateUserCommand command) {
return create(AuthUsernameMother.create(command.username()), AuthPasswordMother.create(command.password()));
}

public static AuthUser withUsername(String username) {
return create(AuthUsernameMother.create(username), AuthPasswordMother.random());
public static AuthUser withUsernameAndPassword(String username, String password) {
return create(AuthUsernameMother.create(username), AuthPasswordMother.create(password));
}
}