Fix test when Bad Request

This commit is contained in:
Ildar Almakaev 2021-03-10 13:38:48 +03:00
parent 12b77eff17
commit a05771ced7

View file

@ -58,20 +58,16 @@ class SchemaRegistryServiceTests extends AbstractBaseTest {
* It should create a new schema w/o submitting a schemaType field to Schema Registry * It should create a new schema w/o submitting a schemaType field to Schema Registry
*/ */
@Test @Test
void shouldCreateNewSchemaWhenSchemaTypeNotPresents() { void shouldBeBadRequestIfNoSchemaType() {
String schema = "{\"subject\":\"%s\",\"schema\":\"{\\\"type\\\": \\\"string\\\"}\"}"; String schema = "{\"subject\":\"%s\",\"schema\":\"{\\\"type\\\": \\\"string\\\"}\"}";
SchemaSubject actualResponse = webTestClient webTestClient
.post() .post()
.uri("/api/clusters/{clusterName}/schemas", LOCAL) .uri("/api/clusters/{clusterName}/schemas", LOCAL)
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
.body(BodyInserters.fromValue(schema.formatted(subject))) .body(BodyInserters.fromValue(schema.formatted(subject)))
.exchange() .exchange()
.expectStatus().isEqualTo(HttpStatus.OK) .expectStatus().isBadRequest();
.expectBody(SchemaSubject.class).returnResult().getResponseBody();
Assertions.assertNotNull(actualResponse);
Assertions.assertEquals(SchemaType.AVRO, actualResponse.getSchemaType());
} }
@Test @Test