-
Notifications
You must be signed in to change notification settings - Fork 9
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 #384 from CaritasDeutschland/refactor-use-rocketch…
…at-config Refactor use rocketchat config
- Loading branch information
Showing
10 changed files
with
205 additions
and
292 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
153 changes: 65 additions & 88 deletions
153
src/main/java/de/caritas/cob/userservice/api/adapters/rocketchat/RocketChatService.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
55 changes: 55 additions & 0 deletions
55
...st/java/de/caritas/cob/userservice/api/adapters/rocketchat/config/RocketChatConfigIT.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,55 @@ | ||
package de.caritas.cob.userservice.api.adapters.rocketchat.config; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.mock.mockito.SpyBean; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
@SpringBootTest | ||
@ActiveProfiles("testing") | ||
class RocketChatConfigIT { | ||
|
||
@SpyBean | ||
private RocketChatConfig underTest; | ||
|
||
@Test | ||
void configurationShouldLoadProperties() { | ||
assertEquals("https://testing.com/api/v1", underTest.getBaseUrl()); | ||
assertEquals("0 0 * * * ?", underTest.getCredentialCron()); | ||
} | ||
|
||
@Test | ||
void getApiUrlShouldReturnUrlWithPath() { | ||
var path = "/this/is/a/path"; | ||
var url = underTest.getApiUrl(path); | ||
|
||
assertEquals("https://testing.com/api/v1" + path, url); | ||
} | ||
|
||
@Test | ||
void getApiUrlShouldReplacePathParams() { | ||
var value = "a-value"; | ||
var path = "/this/is/a/path/{a-variable}/suffix"; | ||
var url = underTest.getApiUrl(path, value); | ||
|
||
assertEquals("https://testing.com/api/v1/this/is/a/path/a-value/suffix", url); | ||
} | ||
|
||
@Test | ||
void getApiUrlShouldRemoveAdditionalSlashes() { | ||
var path = "//this/is//a/path/"; | ||
var url = underTest.getApiUrl(path); | ||
|
||
assertEquals("https://testing.com/api/v1/this/is/a/path", url); | ||
} | ||
|
||
@Test | ||
void getApiUrlShouldReturnUrlWithQueryParams() { | ||
var path = "/this/is/a/path?a=1&b=2"; | ||
var url = underTest.getApiUrl(path); | ||
|
||
assertEquals("https://testing.com/api/v1" + path, url); | ||
} | ||
} |
Oops, something went wrong.