-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from KalinIvanov-l/main
Fix SonarQube #123
- Loading branch information
Showing
106 changed files
with
967 additions
and
555 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
dependencies { | ||
implementation project(':core') | ||
implementation project(':adapter-base') | ||
|
||
implementation 'org.springframework.boot:spring-boot-starter' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' | ||
|
||
testImplementation project(':test-fixtures') | ||
} | ||
|
||
bootJar { | ||
enabled = false | ||
} | ||
|
||
jar { | ||
enabled = true | ||
} |
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
39 changes: 39 additions & 0 deletions
39
...om/optivem/kata/banking/adapter/driver/fake/auth/fake/FakeAuthenticationProviderTest.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.optivem.kata.banking.adapter.driver.fake.auth.fake; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class FakeAuthenticationProviderTest { | ||
private final FakeAuthenticationProvider fakeAuthenticationProvider = new FakeAuthenticationProvider(); | ||
|
||
@Test | ||
void shouldAuthenticateWithValidCredentials() { | ||
var token = new UsernamePasswordAuthenticationToken("user", "password"); | ||
var result = fakeAuthenticationProvider.authenticate(token); | ||
assertNotNull(result); | ||
assertEquals("user", result.getName()); | ||
assertTrue(result.getAuthorities().isEmpty()); | ||
} | ||
|
||
@Test | ||
void shouldThrowExceptionWithNullCredentials() { | ||
assertThrows(IllegalArgumentException.class, () -> fakeAuthenticationProvider.authenticate(null)); | ||
} | ||
|
||
@Test | ||
void shouldReturnAuthenticationWithEmptyAuthorities() { | ||
var token = new UsernamePasswordAuthenticationToken("user", "password"); | ||
var result = fakeAuthenticationProvider.authenticate(token); | ||
assertTrue(result.getAuthorities().isEmpty()); | ||
} | ||
|
||
@Test | ||
void shouldSupportUsernamePasswordAuthenticationToken() { | ||
assertTrue(fakeAuthenticationProvider.supports(UsernamePasswordAuthenticationToken.class)); | ||
} | ||
} |
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
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
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
4 changes: 1 addition & 3 deletions
4
.../java/com/optivem/kata/banking/adapter/driven/messaging/inmemory/ApplicationEventBus.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
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
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
14 changes: 14 additions & 0 deletions
14
...m/kata/banking/adapter/driven/messaging/inmemory/internal/DomainApplicationEventTest.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.optivem.kata.banking.adapter.driven.messaging.inmemory.internal; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class DomainApplicationEventTest { | ||
@Test | ||
void shouldStoreEventData() { | ||
var data = "Test Data"; | ||
var event = new DomainApplicationEvent<>(data, data); | ||
assertEquals(data, event.getData()); | ||
} | ||
} |
Oops, something went wrong.