-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: use beans if available * fix: remove redundant public modifier
- Loading branch information
Showing
8 changed files
with
135 additions
and
32 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 @@ | ||
placeholder.url=https://httpbin.org |
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
42 changes: 42 additions & 0 deletions
42
demo/src/test/java/io/github/zskamljic/restahead/demo/spring/PlaceholderServiceBeanTest.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,42 @@ | ||
package io.github.zskamljic.restahead.demo.spring; | ||
|
||
import io.github.zskamljic.restahead.client.Client; | ||
import io.github.zskamljic.restahead.client.responses.Response; | ||
import io.github.zskamljic.restahead.conversion.Converter; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.mock.mockito.MockBean; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
import java.io.InputStream; | ||
import java.util.Map; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.doReturn; | ||
|
||
@SpringBootTest | ||
@ExtendWith(SpringExtension.class) | ||
class PlaceholderServiceBeanTest { | ||
@MockBean | ||
private Client mockClient; | ||
|
||
@MockBean | ||
private Converter mockConverter; | ||
|
||
@Autowired | ||
private ConfigCombinations.PlaceholderService placeholderService; | ||
|
||
@Test | ||
void placeHolderServiceInjectsBeans() { | ||
doReturn(CompletableFuture.completedFuture(new Response(200, Map.of(), InputStream.nullInputStream()))) | ||
.when(mockClient).execute(any()); | ||
|
||
var response = placeholderService.get(); | ||
|
||
assertNotNull(response); | ||
} | ||
} |
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