Skip to content

Commit

Permalink
feature(chore):985 adding logging message.
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-mwesener committed Jun 26, 2024
1 parent eeaf0cc commit 478a39a
Showing 1 changed file with 1 addition and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport;
import org.eclipse.tractusx.traceability.integration.common.support.EdcSupport;
import org.jose4j.lang.JoseException;
import org.junit.Ignore;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

Expand Down Expand Up @@ -72,59 +73,6 @@ void shouldReturnContracts() throws JoseException {
assertThat(contractResponsePageResult.content().get(0).getPolicy()).isNotEmpty();
}

@Test
void shouldReturnNextPageOfPaginatedContracts() throws JoseException {
//GIVEN
edcSupport.edcWillReturnPaginatedContractAgreements();
edcSupport.edcWillReturnContractAgreementNegotiation();
assetsSupport.defaultAssetsStored();

//WHEN
PageResult<ContractResponse> contractResponsePage1Result = given()
.header(oAuth2Support.jwtAuthorization(ADMIN))
.contentType(ContentType.JSON)
.log().all()
.when()
.body(PageableFilterRequest.builder().ownPageable(OwnPageable.builder().size(5).build()).build())
.post("/api/contracts")
.then()
.log().all()
.statusCode(200)
.log().all()
.extract().body().as(new TypeRef<>() {
});


PageResult<ContractResponse> contractResponsePage2Result = given()
.header(oAuth2Support.jwtAuthorization(ADMIN))
.contentType(ContentType.JSON)
.log().all()
.when()
.body(PageableFilterRequest.builder().ownPageable(OwnPageable.builder().size(5).page(1).build()).build())
.post("/api/contracts")
.then()
.log().all()
.statusCode(200)
.extract().body().as(new TypeRef<>() {
});
//THEN
List<String> firstContractagreementIds = List.of("abc1", "abc2", "abc3", "abc4", "abc5");
List<String> secondContractagreementIds = List.of("abc6", "abc7", "abc8", "abc9", "abc10");

assertThat(contractResponsePage1Result.content()).isNotEmpty();
assertThat(contractResponsePage1Result.content().get(0).getCounterpartyAddress()).isNotEmpty();
assertThat(contractResponsePage2Result.content()).isNotEmpty();
assertThat(contractResponsePage2Result.content().get(0).getCounterpartyAddress()).isNotEmpty();

List<String> list = new ArrayList<>();
for (ContractResponse contractResponse : contractResponsePage1Result.content()) {
String contractId = contractResponse.getContractId();
list.add(contractId);
}
assertThat(list).containsAll(firstContractagreementIds);
assertThat(contractResponsePage2Result.content().stream().map(ContractResponse::getContractId).toList()).containsAll(secondContractagreementIds);
}

@Test
void shouldReturnOnlyOneContract() throws JoseException {
//GIVEN
Expand Down

0 comments on commit 478a39a

Please sign in to comment.