Skip to content

Commit aff0ebc

Browse files
committed
Simple JSON to Map using JsonPojoUtils
Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent e680ccc commit aff0ebc

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ implementation("com.salesforce.revoman:revoman:{revoman-version}")
6868
----
6969

7070
[.lead]
71-
Minimum Java Version required = 11
71+
Minimum Java Version required = 17
7272

7373
toc::[]
7474

buildSrc/src/main/kotlin/revoman.root-conventions.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ spotless {
4949
removeUnusedImports()
5050
googleJavaFormat()
5151
trimTrailingWhitespace()
52-
indentWithSpaces(2)
52+
leadingSpacesToTabs(2)
5353
endWithNewline()
5454
targetExclude("build/**", ".gradle/**", "generated/**", "bin/**", "out/**", "tmp/**")
5555
}
5656
format("documentation") {
5757
target("*.md", "*.adoc")
5858
trimTrailingWhitespace()
59-
indentWithSpaces(2)
59+
leadingSpacesToTabs(2)
6060
endWithNewline()
6161
}
6262
}

src/test/java/com/salesforce/revoman/input/json/JsonPojoUtilsTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,21 @@ void jsonFileToPojo() {
115115
assertThat(nestedBeanFromJson.getBean().getItems()).hasSize(2);
116116
}
117117

118+
@Test
119+
@DisplayName("Simple JSON to Map")
120+
void simpleJsonToMap() {
121+
final var json = """
122+
{
123+
"key1": "value1",
124+
"key2": "value2"
125+
}
126+
""";
127+
final var mapFromJSON =
128+
JsonPojoUtils.<Map<String, String>>jsonToPojo(Map.class, json);
129+
assertThat(mapFromJSON).isNotNull();
130+
assertThat(mapFromJSON).containsExactlyEntriesIn(Map.of("key1", "value1", "key2", "value2"));
131+
}
132+
118133
@Test
119134
@DisplayName("json with Epoch Date To Pojo")
120135
void jsonWithEpochDateToPojo() {

src/test/kotlin/com/salesforce/revoman/internal/postman/PostmanTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PostmanTest {
2424
pm.environment.putAll(
2525
mergeEnvs(
2626
setOf("env-with-regex.json"),
27-
kick.environmentInputStreams(),
27+
emptyList(),
2828
mutableMapOf("un" to "userName"),
2929
)
3030
)

0 commit comments

Comments
 (0)