Skip to content

Commit

Permalink
Break Test Cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sathishk committed Jan 24, 2024
1 parent 9afb4b3 commit f29ea28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,11 @@
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-jsonSchema -->
<dependency>
<groupId>com.github.reinert</groupId>
<artifactId>jjschema</artifactId>
<version>1.16</version>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jsonSchema</artifactId>
<version>2.16.1</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.techatpark.sjson.generator;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.reinert.jjschema.v1.JsonSchemaFactory;
import com.github.reinert.jjschema.v1.JsonSchemaV4Factory;
import com.techatpark.sjson.generator.model.Product;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -23,18 +20,19 @@ public class JsonSchemaGeneratorTest {

private final ObjectMapper objectMapper;

private final JsonSchemaFactory schemaFactory;
private final com.fasterxml.jackson.module.jsonSchema.JsonSchemaGenerator schemaFactory;

public JsonSchemaGeneratorTest() {
jsonSchemaGenerator = new JsonSchemaGenerator();
objectMapper = new ObjectMapper();
schemaFactory = new JsonSchemaV4Factory();
schemaFactory.setAutoPutDollarSchema(true);
schemaFactory = new com.fasterxml.jackson.module.jsonSchema.JsonSchemaGenerator(objectMapper);
}

@Test
void testGenerator() throws Exception {
assertEquals(schemaFactory.createSchema(Product.class),
String rawJsonSchema = objectMapper.writeValueAsString(schemaFactory.generateSchema(Product.class));

assertEquals(objectMapper.readTree(rawJsonSchema),
objectMapper.readTree(jsonSchemaGenerator.create(Product.class)),
"JSON Schema was not generated properly");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.techatpark.sjson.generator.model;
package com.techatpark.sjson.generator;

import java.math.BigDecimal;
import java.util.List;
Expand Down

0 comments on commit f29ea28

Please sign in to comment.