Skip to content

Commit 0fd826f

Browse files
committed
Fix wrong json
1 parent 9f18957 commit 0fd826f

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

httpsnippet-demo/src/main/java/io/github/atkawa7/httpsnippet/demo/swagger/plugins/CodeSampleOperationBuilderPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void apply(OperationContext operationContext) {
6161
throw new RuntimeException("Failed to create json from example");
6262
}
6363

64-
HarPostData postData =
64+
HarPostData postData = ObjectUtils.isNull(example)? null:
6565
new HarPostDataBuilder().withMimeType(MediaType.APPLICATION_JSON).withText(body).build();
6666

6767
HarRequest harRequest =
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package io.github.atkawa7.httpsnippet.utils;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.*;
6+
7+
class HarUtilsTest {
8+
9+
@Test
10+
void harCookieToString() {
11+
}
12+
13+
@Test
14+
void processQueryStrings() {
15+
}
16+
17+
@Test
18+
void processCookies() {
19+
}
20+
21+
@Test
22+
void processParams() {
23+
}
24+
25+
@Test
26+
void processHeaders() {
27+
}
28+
29+
@Test
30+
void defaultMimeType() {
31+
}
32+
}

httpsnippet/src/test/java/io/github/atkawa7/httpsnippet/utils/ObjectUtilsTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void testToJsonString() {
3434
}
3535

3636
@Test
37-
void fromJsonString() {
37+
void testFromJsonString() {
3838

3939
Map<String, Object> h = new HashMap<>();
4040
h.put("foo", "foo");
@@ -59,19 +59,19 @@ void testNewURL() {
5959
}
6060

6161
@Test
62-
void isNotNull() {
62+
void testIsNotNull() {
6363
String nonNull = "foo";
6464
assertTrue(ObjectUtils.isNotNull(nonNull));
6565
}
6666

6767
@Test
68-
void isNull() {
68+
void testIsNull() {
6969
String nullStr = null;
7070
assertTrue(ObjectUtils.isNull(nullStr));
7171
}
7272

7373
@Test
74-
void defaultIfNull() {
74+
void testDefaultIfNull() {
7575
Object nullInteger = null;
7676
String result = ObjectUtils.defaultIfNull(nullInteger, "10");
7777
assertEquals("10", result);
@@ -93,14 +93,14 @@ void defaultIfNull() {
9393

9494
@ParameterizedTest
9595
@MethodSource("streamOfEmptyObjects")
96-
void isEmpty(Object obj) {
96+
void testIsEmpty(Object obj) {
9797
assertTrue(ObjectUtils.isEmpty(obj));
9898
assertFalse(ObjectUtils.isNotEmpty(obj));
9999
}
100100

101101
@ParameterizedTest
102102
@MethodSource("streamOfObjects")
103-
void isNotEmpty(Object obj) {
103+
void testIsNotEmpty(Object obj) {
104104
assertTrue(ObjectUtils.isNotEmpty(obj));
105105
assertFalse(ObjectUtils.isEmpty(obj));
106106
}

0 commit comments

Comments
 (0)