Skip to content

Commit

Permalink
Fix expected files
Browse files Browse the repository at this point in the history
  • Loading branch information
pe-st committed Oct 19, 2023
1 parent b0c3e75 commit b3fef0d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import jakarta.ws.rs.core.MediaType;

import org.apache.commons.io.IOUtils;
import org.apache.http.conn.EofSensorInputStream;
import org.junit.jupiter.api.Test;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -23,8 +22,6 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;

import io.quarkus.test.junit.QuarkusTest;
import io.restassured.internal.RestAssuredResponseImpl;
import io.restassured.response.Response;
import lombok.Getter;
import lombok.Setter;

Expand Down Expand Up @@ -68,23 +65,12 @@ void openapi_json() throws IOException {

String expected = loadResourceFile("openapi.json");

Response response = given().accept(MediaType.APPLICATION_JSON)
.when().get("/openapi");

var responseImpl = (RestAssuredResponseImpl) response;
var contentStream = (EofSensorInputStream) responseImpl.getContent();
var content = new String(contentStream.readAllBytes(), StandardCharsets.UTF_8);
System.out.printf("rest-assured internal%n%s", content);

String document = content;
// String document = response.then().extract().response().asString();

// String document = given().accept(MediaType.APPLICATION_JSON)
// .when().get("/openapi")
// .then()
// .statusCode(200)
// .assertThat().contentType(MediaType.APPLICATION_JSON)
// .extract().response().asString();
String document = given().accept(MediaType.APPLICATION_JSON)
.when().get("/openapi")
.then()
.statusCode(200)
.assertThat().contentType(MediaType.APPLICATION_JSON)
.extract().response().asString();

assertThat("actual: " + document, document, jsonEquals(expected));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ components:
title: EmvTags
type: object
Pan:
$ref: '#/components/schemas/Pan'
description: The number embossed on credit cards
title: PAN (Primary Account Number)
type: string
PinCheckRequest:
description: Request for checking a PIN
properties:
Expand All @@ -94,7 +96,7 @@ components:
properties:
result:
allOf:
- $ref: '#/components/schemas/Code1'
- $ref: '#/components/schemas/Code'
description: Result of the request
type: string
tries:
Expand Down Expand Up @@ -126,7 +128,7 @@ components:
type: string
result:
allOf:
- $ref: '#/components/schemas/Code'
- $ref: '#/components/schemas/Code1'
description: Result of the request
type: string
type: object
Expand Down
8 changes: 5 additions & 3 deletions code-first-openapi-quarkus/src/test/resources/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
}
},
"Pan" : {
"$ref" : "#/components/schemas/Pan"
"title" : "PAN (Primary Account Number)",
"description" : "The number embossed on credit cards",
"type" : "string"
},
"PinCheckRequest" : {
"description" : "Request for checking a PIN",
Expand Down Expand Up @@ -122,7 +124,7 @@
"description" : "Result of the request",
"type" : "string",
"allOf" : [ {
"$ref" : "#/components/schemas/Code1"
"$ref" : "#/components/schemas/Code"
} ]
},
"tries" : {
Expand Down Expand Up @@ -160,7 +162,7 @@
"description" : "Result of the request",
"type" : "string",
"allOf" : [ {
"$ref" : "#/components/schemas/Code"
"$ref" : "#/components/schemas/Code1"
} ]
},
"approvalCode" : {
Expand Down
8 changes: 5 additions & 3 deletions code-first-openapi-quarkus/src/test/resources/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ components:
description: Terminal Country Code
type: string
Pan:
$ref: '#/components/schemas/Pan'
title: PAN (Primary Account Number)
description: The number embossed on credit cards
type: string
PinCheckRequest:
description: Request for checking a PIN
required:
Expand Down Expand Up @@ -97,7 +99,7 @@ components:
description: Result of the request
type: string
allOf:
- $ref: '#/components/schemas/Code1'
- $ref: '#/components/schemas/Code'
tries:
format: int32
description: Number of remaining tries
Expand Down Expand Up @@ -126,7 +128,7 @@ components:
description: Result of the request
type: string
allOf:
- $ref: '#/components/schemas/Code'
- $ref: '#/components/schemas/Code1'
approvalCode:
description: Code referencing the successful authorization
type: string
Expand Down

0 comments on commit b3fef0d

Please sign in to comment.