Skip to content

Commit

Permalink
chore(core): cleanup test setup in DefaultJsonComponentsServiceTest a…
Browse files Browse the repository at this point in the history
…nd DefaultXmlComponentsServiceTest
  • Loading branch information
sam0r040 committed Feb 23, 2024
1 parent dcdec2f commit 76cda26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
import io.github.stavshamir.springwolf.schemas.example.ExampleJsonValueGenerator;
import io.github.stavshamir.springwolf.schemas.example.SchemaWalkerProvider;
import io.github.stavshamir.springwolf.schemas.postprocessor.ExampleGeneratorPostProcessor;
import io.github.stavshamir.springwolf.schemas.postprocessor.SchemasPostProcessor;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -40,16 +38,11 @@ class DefaultJsonComponentsServiceTest {

private static final String CONTENT_TYPE_APPLICATION_JSON = "application/json";

private final SchemasPostProcessor schemasPostProcessor = Mockito.mock(SchemasPostProcessor.class);
private final SchemasPostProcessor schemasPostProcessor2 = Mockito.mock(SchemasPostProcessor.class);

private final ComponentsService componentsService = new DefaultComponentsService(
List.of(),
List.of(
new ExampleGeneratorPostProcessor(new SchemaWalkerProvider(
List.of(new DefaultSchemaWalker<>(new ExampleJsonValueGenerator())))),
schemasPostProcessor,
schemasPostProcessor2),
List.of(new DefaultSchemaWalker<>(new ExampleJsonValueGenerator()))))),
new SwaggerSchemaUtil(),
new SpringwolfConfigProperties());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import io.github.stavshamir.springwolf.schemas.example.ExampleXmlValueGenerator;
import io.github.stavshamir.springwolf.schemas.example.SchemaWalkerProvider;
import io.github.stavshamir.springwolf.schemas.postprocessor.ExampleGeneratorPostProcessor;
import io.github.stavshamir.springwolf.schemas.postprocessor.SchemasPostProcessor;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;
Expand All @@ -22,7 +21,6 @@
import lombok.NoArgsConstructor;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -39,13 +37,13 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

class DefaultXmlComponentsServiceTest {
private final SchemasPostProcessor schemasPostProcessor = Mockito.mock(SchemasPostProcessor.class);
private final ComponentsService componentsService = new DefaultComponentsService(
List.of(),
List.of(
new ExampleGeneratorPostProcessor(new SchemaWalkerProvider(List.of(new DefaultSchemaWalker<>(
new ExampleXmlValueGenerator(new DefaultExampleXmlValueSerializer()))))),
schemasPostProcessor),
new ExampleGeneratorPostProcessor(new SchemaWalkerProvider(
List.of(new DefaultSchemaWalker<>(
new ExampleXmlValueGenerator(new DefaultExampleXmlValueSerializer()
)))))),
new SwaggerSchemaUtil(),
new SpringwolfConfigProperties());
private static final ObjectMapper objectMapper =
Expand Down Expand Up @@ -164,7 +162,8 @@ private static class ArrayFoo {
}

@NoArgsConstructor
private static class ListWrapper extends ArrayList<String> {}
private static class ListWrapper extends ArrayList<String> {
}

@Data
@NoArgsConstructor
Expand Down Expand Up @@ -239,13 +238,16 @@ public class SchemaAnnotationFoo {
}

@Schema(anyOf = {ImplementationOne.class, ImplementationTwo.class})
public interface AnyOf {}
public interface AnyOf {
}

@Schema(allOf = {ImplementationOne.class, ImplementationTwo.class})
public interface AllOf {}
public interface AllOf {
}

@Schema(oneOf = {ImplementationOne.class, ImplementationTwo.class})
public interface OneOf {}
public interface OneOf {
}

@Data
@NoArgsConstructor
Expand Down

0 comments on commit 76cda26

Please sign in to comment.