forked from citrusframework/citrus
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deps): upgrade to spring v6.2.0
this change is breaking, because Spring v6.2.0 is not compatible with releases prior to it. see the [Spring Release Notes](https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.2-Release-Notes) for more information.
- Loading branch information
Showing
8 changed files
with
231 additions
and
30 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
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
56 changes: 56 additions & 0 deletions
56
tools/restdocs/src/test/java/org/citrusframework/restdocs/http/AbstractHttpRequestTest.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,56 @@ | ||
package org.citrusframework.restdocs.http; | ||
|
||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.HttpMethod; | ||
import org.springframework.http.HttpRequest; | ||
import org.testng.annotations.Test; | ||
|
||
import java.net.URI; | ||
import java.util.HashMap; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.doReturn; | ||
import static org.mockito.Mockito.mock; | ||
|
||
public abstract class AbstractHttpRequestTest<F extends HttpRequest> { | ||
|
||
protected F fixture; | ||
|
||
protected abstract HttpRequest getDelegate(); | ||
|
||
@Test | ||
public void getHeadersReturnsHeaders() { | ||
var httpHeaders = mock(HttpHeaders.class); | ||
doReturn(httpHeaders).when(getDelegate()).getHeaders(); | ||
|
||
assertThat(fixture.getHeaders()) | ||
.isEqualTo(httpHeaders); | ||
} | ||
|
||
@Test | ||
public void getMethodReturnsMethod() { | ||
var httpMethod = mock(HttpMethod.class); | ||
doReturn(httpMethod).when(getDelegate()).getMethod(); | ||
|
||
assertThat(fixture.getMethod()) | ||
.isEqualTo(httpMethod); | ||
} | ||
|
||
@Test | ||
public void getURIReturnsURI() { | ||
var uri = mock(URI.class); | ||
doReturn(uri).when(getDelegate()).getURI(); | ||
|
||
assertThat(fixture.getURI()) | ||
.isEqualTo(uri); | ||
} | ||
|
||
@Test | ||
public void getAttributesReturnsAttributes() { | ||
var attributes = new HashMap<String, Object>(); | ||
doReturn(attributes).when(getDelegate()).getAttributes(); | ||
|
||
assertThat(fixture.getAttributes()) | ||
.isEqualTo(attributes); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...s/restdocs/src/test/java/org/citrusframework/restdocs/http/CachedBodyHttpRequestTest.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,43 @@ | ||
package org.citrusframework.restdocs.http; | ||
|
||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
import org.springframework.http.HttpRequest; | ||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class CachedBodyHttpRequestTest extends AbstractHttpRequestTest<CachedBodyHttpRequest> { | ||
|
||
private static final byte[] BODY = "foo".getBytes(); | ||
|
||
@Mock | ||
private HttpRequest delegate; | ||
|
||
private AutoCloseable openedMocks; | ||
|
||
@Override | ||
protected HttpRequest getDelegate() { | ||
return delegate; | ||
} | ||
|
||
@BeforeMethod | ||
public void beforeMethodSetup() { | ||
openedMocks = MockitoAnnotations.openMocks(this); | ||
|
||
fixture = new CachedBodyHttpRequest(delegate, BODY); | ||
} | ||
|
||
@AfterMethod | ||
public void afterMethodTeardown() throws Exception { | ||
openedMocks.close(); | ||
} | ||
|
||
@Test | ||
public void getBodyReturnsBody() { | ||
assertThat(fixture.getBody()) | ||
.isEqualTo(BODY); | ||
} | ||
} |
Oops, something went wrong.