Skip to content

Commit 1b1b614

Browse files
authored
Fix split packages (#156)
Fixes #149.
1 parent 51d1be4 commit 1b1b614

File tree

82 files changed

+204
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+204
-190
lines changed
Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.belgif.rest.problem;
1+
package io.github.belgif.rest.problem.it;
22

33
import static org.assertj.core.api.Assertions.*;
44

@@ -15,14 +15,17 @@
1515
import com.fasterxml.jackson.databind.SerializationFeature;
1616
import com.fasterxml.jackson.databind.cfg.PackageVersion;
1717

18+
import io.github.belgif.rest.problem.BadRequestProblem;
19+
import io.github.belgif.rest.problem.DefaultProblem;
20+
import io.github.belgif.rest.problem.ProblemModule;
21+
import io.github.belgif.rest.problem.TooManyRequestsProblem;
1822
import io.github.belgif.rest.problem.api.InEnum;
1923
import io.github.belgif.rest.problem.api.Input;
2024
import io.github.belgif.rest.problem.api.InputValidationIssue;
2125
import io.github.belgif.rest.problem.api.InputValidationIssues;
2226
import io.github.belgif.rest.problem.api.Problem;
23-
import io.github.belgif.rest.problem.registry.TestProblemTypeRegistry;
2427

25-
abstract class AbstractJacksonSerializationTest {
28+
public abstract class AbstractJacksonSerializationTest {
2629

2730
private ObjectMapper mapper;
2831

@@ -32,7 +35,7 @@ static void printJacksonVersion() {
3235
}
3336

3437
@BeforeEach
35-
void setUp() {
38+
public void setUp() {
3639
mapper = new ObjectMapper();
3740
mapper.enable(SerializationFeature.INDENT_OUTPUT);
3841
TestProblemTypeRegistry registry = new TestProblemTypeRegistry();
@@ -41,37 +44,37 @@ void setUp() {
4144
}
4245

4346
@Test
44-
void badRequestProblem() throws JsonProcessingException {
47+
public void badRequestProblem() throws JsonProcessingException {
4548
BadRequestProblem problem = new BadRequestProblem();
4649
problem.setDetail("my detail message");
4750
problem.setAdditionalProperty("additional", "property");
4851
assertSerializationRoundtrip(problem);
4952
}
5053

5154
@Test
52-
void customProblem() throws JsonProcessingException {
55+
public void customProblem() throws JsonProcessingException {
5356
CustomProblem problem = new CustomProblem("custom");
5457
problem.setAdditionalProperty("additional", "property");
5558
assertSerializationRoundtrip(problem);
5659
}
5760

5861
@Test
59-
void retryAfterProblem() throws JsonProcessingException {
62+
public void retryAfterProblem() throws JsonProcessingException {
6063
TooManyRequestsProblem problem = new TooManyRequestsProblem();
6164
problem.setRetryAfterSec(60L);
6265
problem.setAdditionalProperty("additional", "property");
6366
assertSerializationRoundtrip(problem);
6467
}
6568

6669
@Test
67-
void badRequestProblemReplacedSsin() throws JsonProcessingException {
70+
public void badRequestProblemReplacedSsin() throws JsonProcessingException {
6871
BadRequestProblem problem = new BadRequestProblem(
6972
InputValidationIssues.replacedSsin(InEnum.BODY, "parent[1].ssin", "12345678901", "23456789012"));
7073
assertSerializationRoundtrip(problem);
7174
}
7275

7376
@Test
74-
void badRequestProblemMultipleInputs() throws JsonProcessingException {
77+
public void badRequestProblemMultipleInputs() throws JsonProcessingException {
7578
BadRequestProblem problem = new BadRequestProblem();
7679
problem.setDetail("my detail message");
7780
InputValidationIssue issue = new InputValidationIssue();
@@ -85,7 +88,7 @@ void badRequestProblemMultipleInputs() throws JsonProcessingException {
8588
}
8689

8790
@Test
88-
void badRequestProblemWithInNameValueAndInputsArray() throws JsonProcessingException {
91+
public void badRequestProblemWithInNameValueAndInputsArray() throws JsonProcessingException {
8992
String json = "{\n"
9093
+ " \"type\": \"urn:problem-type:belgif:badRequest\",\n"
9194
+ " \"href\": \"https://www.belgif.be/specification/rest/api-guide/problems/badRequest.html\",\n"
@@ -116,7 +119,7 @@ void badRequestProblemWithInNameValueAndInputsArray() throws JsonProcessingExcep
116119
}
117120

118121
@Test
119-
void badRequestProblemWithInputsArrayAndInNameValue() throws JsonProcessingException {
122+
public void badRequestProblemWithInputsArrayAndInNameValue() throws JsonProcessingException {
120123
String json = "{\n"
121124
+ " \"type\": \"urn:problem-type:belgif:badRequest\",\n"
122125
+ " \"href\": \"https://www.belgif.be/specification/rest/api-guide/problems/badRequest.html\",\n"
@@ -146,7 +149,7 @@ void badRequestProblemWithInputsArrayAndInNameValue() throws JsonProcessingExcep
146149
}
147150

148151
@Test
149-
void unmappedProblem() throws JsonProcessingException {
152+
public void unmappedProblem() throws JsonProcessingException {
150153
mapper = new ObjectMapper();
151154
mapper.enable(SerializationFeature.INDENT_OUTPUT);
152155

@@ -161,7 +164,7 @@ void unmappedProblem() throws JsonProcessingException {
161164
}
162165

163166
@Test
164-
void legacyInvalidParamProblem() throws JsonProcessingException {
167+
public void legacyInvalidParamProblem() throws JsonProcessingException {
165168
String json = "{\n"
166169
+ " \"type\": \"urn:problem-type:belgif:badRequest\",\n"
167170
+ " \"href\": \"https://www.belgif.be/specification/rest/api-guide/problems/badRequest.html\",\n"
@@ -184,7 +187,7 @@ void legacyInvalidParamProblem() throws JsonProcessingException {
184187
}
185188

186189
@Test
187-
void unknownProblemWithMessage() throws JsonProcessingException {
190+
public void unknownProblemWithMessage() throws JsonProcessingException {
188191
String json = "{\n"
189192
+ " \"id\" : \"08eb8aa6-d4a5-44fc-b25d-007b9f6a272a\",\n"
190193
+ " \"code\" : \"Bad Request\",\n"
@@ -203,7 +206,7 @@ void unknownProblemWithMessage() throws JsonProcessingException {
203206
}
204207

205208
@Test
206-
void additionalExceptionProperties() throws JsonProcessingException {
209+
public void additionalExceptionProperties() throws JsonProcessingException {
207210
BadRequestProblem problem = new BadRequestProblem();
208211
problem.setAdditionalProperty("cause", "cause");
209212
problem.setAdditionalProperty("stackTrace", "stackTrace");
@@ -214,7 +217,7 @@ void additionalExceptionProperties() throws JsonProcessingException {
214217
}
215218

216219
@Test
217-
void issueWithStatusAndInstance() throws JsonProcessingException {
220+
public void issueWithStatusAndInstance() throws JsonProcessingException {
218221
BadRequestProblem problem = new BadRequestProblem();
219222
problem.setDetail("my detail message");
220223
InputValidationIssue issue = new InputValidationIssue().detail("test");
@@ -225,7 +228,7 @@ void issueWithStatusAndInstance() throws JsonProcessingException {
225228
}
226229

227230
@Test
228-
void issueWithNullValue() throws JsonProcessingException {
231+
public void issueWithNullValue() throws JsonProcessingException {
229232
BadRequestProblem problem = new BadRequestProblem(
230233
new InputValidationIssue(InEnum.BODY, "id", null));
231234
String json = mapper.writeValueAsString(problem);
@@ -234,15 +237,15 @@ void issueWithNullValue() throws JsonProcessingException {
234237
}
235238

236239
@Test
237-
void issueWithNullInputValue() throws JsonProcessingException {
240+
public void issueWithNullInputValue() throws JsonProcessingException {
238241
BadRequestProblem problem = new BadRequestProblem(new InputValidationIssue()
239242
.inputs(Input.body("a", null), Input.body("b", null)));
240243
String json = mapper.writeValueAsString(problem);
241244
assertThat(json).doesNotContain("null");
242245
assertSerializationRoundtrip(problem);
243246
}
244247

245-
void assertSerializationRoundtrip(Problem problem) throws JsonProcessingException {
248+
protected void assertSerializationRoundtrip(Problem problem) throws JsonProcessingException {
246249
String json = mapper.writeValueAsString(problem);
247250
print(json);
248251
Problem result = mapper.readValue(json, Problem.class);
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.belgif.rest.problem;
1+
package io.github.belgif.rest.problem.it;
22

33
import static org.hamcrest.Matchers.*;
44

@@ -7,29 +7,29 @@
77
import io.restassured.http.ContentType;
88
import io.restassured.specification.RequestSpecification;
99

10-
abstract class AbstractOpenApiValidationSpringBootIT {
10+
public abstract class AbstractOpenApiValidationSpringBootIT {
1111

1212
private static final String BAD_REQUEST_URN = "urn:problem-type:belgif:badRequest";
1313
private static final String SCHEMA_VIOLATION_URN = "urn:problem-type:belgif:input-validation:schemaViolation";
1414

1515
protected abstract RequestSpecification getSpec();
1616

1717
@Test
18-
void validPathParamWorksTest() {
18+
public void validPathParamWorksTest() {
1919
getSpec().when().get("/myFirstPath/abc1234567").then().assertThat()
2020
.statusCode(200)
2121
.body(equalTo("All good!"));
2222
}
2323

2424
@Test
25-
void notFound() {
25+
public void notFound() {
2626
getSpec().when().get("/not/found").then().assertThat()
2727
.statusCode(404)
2828
.body("type", equalTo("urn:problem-type:belgif:resourceNotFound"));
2929
}
3030

3131
@Test
32-
void unknownQueryParamTest() {
32+
public void unknownQueryParamTest() {
3333
getSpec().when().queryParam("myUnknownParam", 123).get("/myFirstPath").then().assertThat()
3434
.statusCode(400)
3535
.body("type", equalTo(BAD_REQUEST_URN))
@@ -43,7 +43,7 @@ void unknownQueryParamTest() {
4343
}
4444

4545
@Test
46-
void missingQueryParamTest() {
46+
public void missingQueryParamTest() {
4747
getSpec().when().get("/myQueryPath").then().assertThat()
4848
.statusCode(400)
4949
.body("type", equalTo(BAD_REQUEST_URN))
@@ -57,7 +57,7 @@ void missingQueryParamTest() {
5757
}
5858

5959
@Test
60-
void invalidPathParamTest() {
60+
public void invalidPathParamTest() {
6161
getSpec().when().get("/myFirstPath/a1a1234567").then().assertThat()
6262
.statusCode(400)
6363
.body("type", equalTo(BAD_REQUEST_URN))
@@ -71,7 +71,7 @@ void invalidPathParamTest() {
7171
}
7272

7373
@Test
74-
void pathParamTooShortTest() {
74+
public void pathParamTooShortTest() {
7575
getSpec().when().get("/myFirstPath/abc").then().assertThat()
7676
.statusCode(400)
7777
.body("type", equalTo(BAD_REQUEST_URN))
@@ -85,14 +85,14 @@ void pathParamTooShortTest() {
8585
}
8686

8787
@Test
88-
void validQueryParamWorksTest() {
88+
public void validQueryParamWorksTest() {
8989
getSpec().when().queryParam("myParam", "abc1234567").get("/myFirstPath").then().assertThat()
9090
.statusCode(200)
9191
.body(equalTo("All good!"));
9292
}
9393

9494
@Test
95-
void invalidQueryParamTest() {
95+
public void invalidQueryParamTest() {
9696
getSpec().when().queryParam("myParam", "a1a1234567").get("/myFirstPath").then().assertThat()
9797
.statusCode(400)
9898
.body("type", equalTo(BAD_REQUEST_URN))
@@ -106,7 +106,7 @@ void invalidQueryParamTest() {
106106
}
107107

108108
@Test
109-
void queryParamTooShortTest() {
109+
public void queryParamTooShortTest() {
110110
getSpec().when().queryParam("myParam", "abc").get("/myFirstPath").then().assertThat()
111111
.statusCode(400)
112112
.body("type", equalTo(BAD_REQUEST_URN))
@@ -120,7 +120,7 @@ void queryParamTooShortTest() {
120120
}
121121

122122
@Test
123-
void absentHeaderParamTest() {
123+
public void absentHeaderParamTest() {
124124
getSpec().when().get("/myHeaderPath").then().assertThat()
125125
.statusCode(400)
126126
.body("type", equalTo(BAD_REQUEST_URN))
@@ -134,7 +134,7 @@ void absentHeaderParamTest() {
134134
}
135135

136136
@Test
137-
void headerParamTooShortTest() {
137+
public void headerParamTooShortTest() {
138138
getSpec().when().header("MyHeader", "abc").get("/myHeaderPath").then().assertThat()
139139
.statusCode(400)
140140
.body("type", equalTo(BAD_REQUEST_URN))
@@ -148,7 +148,7 @@ void headerParamTooShortTest() {
148148
}
149149

150150
@Test
151-
void requestBodyJsonParseErrorTest() {
151+
public void requestBodyJsonParseErrorTest() {
152152
getSpec().contentType(ContentType.JSON).body("{" +
153153
"\"name\" ; this is my name" +
154154
"}").when().post("/myFirstPath").then().assertThat()
@@ -163,7 +163,7 @@ void requestBodyJsonParseErrorTest() {
163163
}
164164

165165
@Test
166-
void missingRequestBodyTest() {
166+
public void missingRequestBodyTest() {
167167
getSpec().contentType(ContentType.JSON).when().post("/myFirstPath").then().assertThat()
168168
.statusCode(400)
169169
.body("type", equalTo(BAD_REQUEST_URN))
@@ -176,7 +176,7 @@ void missingRequestBodyTest() {
176176
}
177177

178178
@Test
179-
void invalidRequestBodyTest() {
179+
public void invalidRequestBodyTest() {
180180
getSpec().contentType(ContentType.JSON).body("{" +
181181
"\"myFirstProperty\": \"yes\"," +
182182
"\"myInnerObject\": {" +
@@ -195,7 +195,7 @@ void invalidRequestBodyTest() {
195195
}
196196

197197
@Test
198-
void missingPropertiesInRequestBodyNestedSchemaTest() {
198+
public void missingPropertiesInRequestBodyNestedSchemaTest() {
199199
getSpec().contentType(ContentType.JSON).body("{" +
200200
"\"myInnerObject\": {" +
201201
"\"nonExistingParam\": \"abc\"" +
@@ -218,7 +218,7 @@ void missingPropertiesInRequestBodyNestedSchemaTest() {
218218
}
219219

220220
@Test
221-
void missingPropertiesInRequestBodyTest() {
221+
public void missingPropertiesInRequestBodyTest() {
222222
getSpec().contentType(ContentType.JSON).body("{" +
223223
"}").when().post("/myFirstPath").then().assertThat()
224224
.statusCode(400)
@@ -234,7 +234,7 @@ void missingPropertiesInRequestBodyTest() {
234234
}
235235

236236
@Test
237-
void nonCompliantRegexInAllOfRequestBodyTest() {
237+
public void nonCompliantRegexInAllOfRequestBodyTest() {
238238
getSpec().contentType(ContentType.JSON).body("{\n" +
239239
" \"myFirstProperty\": \"yes\",\n" +
240240
" \"myInnerObject\": {\n" +
@@ -261,7 +261,7 @@ void nonCompliantRegexInAllOfRequestBodyTest() {
261261
}
262262

263263
@Test
264-
void missingPropertiesInAllOfRequestBodyTest() {
264+
public void missingPropertiesInAllOfRequestBodyTest() {
265265
getSpec().contentType(ContentType.JSON).body("{\n" +
266266
" \"myFirstProperty\": \"yes\",\n" +
267267
" \"myInnerObject\": {\n" +
@@ -284,7 +284,7 @@ void missingPropertiesInAllOfRequestBodyTest() {
284284
}
285285

286286
@Test
287-
void missingPropertiesInOneOfRequestBodyTest() {
287+
public void missingPropertiesInOneOfRequestBodyTest() {
288288
getSpec().contentType(ContentType.JSON).body("{\n" +
289289
" \"myFirstProperty\": \"yes\",\n" +
290290
" \"myInnerObject\": {\n" +
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package io.github.belgif.rest.problem;
1+
package io.github.belgif.rest.problem.it;
22

33
import static org.hamcrest.Matchers.*;
44

55
import org.junit.jupiter.api.Test;
66

7-
abstract class AbstractRestProblemEEIT extends AbstractRestProblemIT {
7+
public abstract class AbstractRestProblemEEIT extends AbstractRestProblemIT {
88

99
@Test
10-
void ejb() {
10+
public void ejb() {
1111
getSpec().when()
1212
.get("/ejb").then().assertThat()
1313
.statusCode(400)

0 commit comments

Comments
 (0)