File tree Expand file tree Collapse file tree 3 files changed +31
-6
lines changed
swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core Expand file tree Collapse file tree 3 files changed +31
-6
lines changed Original file line number Diff line number Diff line change 2121import org .apache .servicecomb .swagger .generator .core .model .SwaggerOperations ;
2222import org .junit .jupiter .api .AfterAll ;
2323import org .junit .jupiter .api .Assertions ;
24+ import org .junit .jupiter .api .BeforeAll ;
2425import org .junit .jupiter .api .Test ;
26+ import org .junit .jupiter .api .TestInstance ;
2527
2628import io .swagger .v3 .oas .annotations .headers .Header ;
2729import io .swagger .v3 .oas .annotations .media .Content ;
3032import io .swagger .v3 .oas .annotations .responses .ApiResponses ;
3133import jakarta .ws .rs .core .MediaType ;
3234
35+ @ TestInstance (TestInstance .Lifecycle .PER_CLASS )
3336public class TestApiResponse {
34- static SwaggerOperations swaggerOperations = SwaggerOperations .generate (ApiResponseAnnotation .class );
37+
38+ SwaggerOperations swaggerOperations ;
39+
40+ @ BeforeAll
41+ public void setUp () {
42+ swaggerOperations = SwaggerOperations .generate (ApiResponseAnnotation .class );
43+ }
3544
3645 @ AfterAll
37- public static void teardown () {
46+ public void tearDown () {
3847 swaggerOperations = null ;
3948 }
4049
Original file line number Diff line number Diff line change 2727import org .hamcrest .MatcherAssert ;
2828import org .junit .jupiter .api .AfterAll ;
2929import org .junit .jupiter .api .Assertions ;
30+ import org .junit .jupiter .api .BeforeAll ;
3031import org .junit .jupiter .api .Test ;
32+ import org .junit .jupiter .api .TestInstance ;
3133
3234import io .swagger .v3 .oas .annotations .OpenAPIDefinition ;
3335import io .swagger .v3 .oas .annotations .Operation ;
3941import io .swagger .v3 .oas .annotations .responses .ApiResponse ;
4042import io .swagger .v3 .oas .annotations .tags .Tag ;
4143
44+ @ TestInstance (TestInstance .Lifecycle .PER_CLASS )
4245public class TestOperationGenerator {
43- static SwaggerOperations swaggerOperations = SwaggerOperations .generate (TestClass .class );
46+ SwaggerOperations swaggerOperations ;
47+
48+ @ BeforeAll
49+ public void setUp () {
50+ swaggerOperations = SwaggerOperations .generate (TestClass .class );
51+ }
4452
4553 @ AfterAll
46- public static void teardown () {
54+ public void tearDown () {
4755 swaggerOperations = null ;
4856 }
4957
Original file line number Diff line number Diff line change 2828import org .hamcrest .Matchers ;
2929import org .junit .jupiter .api .AfterAll ;
3030import org .junit .jupiter .api .Assertions ;
31+ import org .junit .jupiter .api .BeforeAll ;
3132import org .junit .jupiter .api .Test ;
33+ import org .junit .jupiter .api .TestInstance ;
3234
3335import io .swagger .v3 .oas .annotations .Operation ;
3436import io .swagger .v3 .oas .annotations .media .Content ;
4143import jakarta .validation .constraints .NotNull ;
4244import jakarta .ws .rs .core .MediaType ;
4345
46+ @ TestInstance (TestInstance .Lifecycle .PER_CLASS )
4447public class OperationMethodAnnotationProcessorTest {
45- static SwaggerOperations swaggerOperations = SwaggerOperations .generate (TestClass .class );
48+ SwaggerOperations swaggerOperations ;
49+
50+ @ BeforeAll
51+ public void setUp () {
52+ swaggerOperations = SwaggerOperations .generate (TestClass .class );
53+ }
4654
4755 @ AfterAll
48- public static void teardown () {
56+ public void tearDown () {
4957 swaggerOperations = null ;
5058 }
5159
You can’t perform that action at this time.
0 commit comments