-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only add default configure if WireMock enabled
- Loading branch information
1 parent
67d6784
commit d5eaf0a
Showing
2 changed files
with
35 additions
and
4 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
28 changes: 28 additions & 0 deletions
28
wiremock-spring-boot-example/src/test/java/app/NotEnabledTest.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,28 @@ | ||
package app; | ||
|
||
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.get; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
import com.github.tomakehurst.wiremock.client.WireMock; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.core.env.Environment; | ||
import wiremock.org.apache.hc.client5.http.HttpHostConnectException; | ||
|
||
@SpringBootTest | ||
class NotEnabledTest { | ||
|
||
@Autowired private Environment env; | ||
|
||
@Test | ||
void shouldNotHaveWireMockConfigured() { | ||
assertThrows( | ||
HttpHostConnectException.class, | ||
() -> WireMock.stubFor(get("/ping").willReturn(aResponse().withStatus(200)))); | ||
|
||
assertThat(this.env.getProperty("wiremock.server.baseUrl")).isNull(); | ||
} | ||
} |