Skip to content

Commit 65f6dbf

Browse files
committed
Fix tests
1 parent 6bf28eb commit 65f6dbf

File tree

13 files changed

+15
-34
lines changed

13 files changed

+15
-34
lines changed

src/main/kotlin/wu/seal/jsontokotlin/supporter/CustomJsonLibSupporter.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import wu.seal.jsontokotlin.utils.numberOf
1414

1515
object CustomJsonLibSupporter : IJsonLibSupporter {
1616

17-
private val indent = lazy { getIndent() }
1817

1918
private val propertyAnnotation
2019
get() = ConfigManager.customPropertyAnnotationFormatString
@@ -46,12 +45,12 @@ object CustomJsonLibSupporter : IJsonLibSupporter {
4645
val propertyAnnotationString = getPropertyAnnotationString(rawPropertyName)
4746

4847
propertyAnnotationString.split("\n").forEach {
49-
customJsonLibSupportPropertyBuilder.append(indent.value)
48+
customJsonLibSupportPropertyBuilder.append(getIndent())
5049
customJsonLibSupportPropertyBuilder.append(it)
5150
customJsonLibSupportPropertyBuilder.append("\n")
5251
}
5352

54-
customJsonLibSupportPropertyBuilder.append(indent.value)
53+
customJsonLibSupportPropertyBuilder.append(getIndent())
5554

5655
customJsonLibSupportPropertyBuilder.append(KPropertyKeyword.get())
5756

src/main/kotlin/wu/seal/jsontokotlin/supporter/FastjsonSupporter.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import wu.seal.jsontokotlin.utils.getIndent
1313

1414
object FastjsonSupporter : IJsonLibSupporter {
1515

16-
private val indent = lazy { getIndent() }
1716

1817
override val annotationImportClassString: String
1918
get() = "import com.alibaba.fastjson.annotation.JSONField"
@@ -25,7 +24,7 @@ object FastjsonSupporter : IJsonLibSupporter {
2524

2625
val fastjsonSupportPropertyBuilder = StringBuilder()
2726

28-
fastjsonSupportPropertyBuilder.append(indent.value)
27+
fastjsonSupportPropertyBuilder.append(getIndent())
2928

3029
fastjsonSupportPropertyBuilder.append(FastjsonSupporter.propertyAnnotationFormat.format(rawPropertyName))
3130

src/main/kotlin/wu/seal/jsontokotlin/supporter/GsonSupporter.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ interface IGsonSupporter {
2424

2525
object GsonSupporter : IGsonSupporter {
2626

27-
private val indent = lazy { getIndent() }
2827

2928
/**
3029
* When adapter Gson lib at most ,We should import the Anotation Class
@@ -37,7 +36,7 @@ object GsonSupporter : IGsonSupporter {
3736

3837
val gsonSupportPropertyBuilder = StringBuilder()
3938

40-
gsonSupportPropertyBuilder.append(indent.value)
39+
gsonSupportPropertyBuilder.append(getIndent())
4140

4241
gsonSupportPropertyBuilder.append(GsonSupporter.propertyAnnotationFormat.format(rawPropertyName))
4342

src/main/kotlin/wu/seal/jsontokotlin/supporter/JacksonSupporter.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ interface IJacksonSupporter {
2323

2424
object JacksonSupporter : IJacksonSupporter {
2525

26-
private val indent = lazy { getIndent() }
27-
2826
val anotaionFormat = "@JsonProperty(\"%s\")"
2927

3028
override fun getJacksonSupporterProperty(rawPropertyName: String, propertyType: String): String {
3129

3230
val jacksonSupportPropertyBuilder = StringBuilder()
3331

34-
jacksonSupportPropertyBuilder.append(indent.value)
32+
jacksonSupportPropertyBuilder.append(getIndent())
3533

3634
jacksonSupportPropertyBuilder.append(JacksonSupporter.anotaionFormat.format(rawPropertyName))
3735

src/main/kotlin/wu/seal/jsontokotlin/supporter/LoganSquareSupporter.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import wu.seal.jsontokotlin.utils.getIndent
1313

1414
object LoganSquareSupporter : IJsonLibSupporter {
1515

16-
private val indent = lazy { getIndent() }
17-
1816
val classAnnotation = "@JsonObject"
1917
val propertyAnnotationFormat = "@JsonField(name = arrayOf(\"%s\"))"
2018

@@ -29,7 +27,7 @@ object LoganSquareSupporter : IJsonLibSupporter {
2927

3028
val loganSquareSupportPropertyBuilder = StringBuilder()
3129

32-
loganSquareSupportPropertyBuilder.append(indent.value)
30+
loganSquareSupportPropertyBuilder.append(getIndent())
3331

3432
loganSquareSupportPropertyBuilder.append(LoganSquareSupporter.propertyAnnotationFormat.format(rawPropertyName))
3533

src/main/kotlin/wu/seal/jsontokotlin/supporter/MoShiSupporter.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import wu.seal.jsontokotlin.utils.getIndent
1212

1313
object MoShiSupporter : IJsonLibSupporter {
1414

15-
private val indent = lazy { getIndent() }
16-
1715
override val annotationImportClassString: String
1816
get() = "import com.squareup.moshi.Json"
1917

@@ -24,7 +22,7 @@ object MoShiSupporter : IJsonLibSupporter {
2422
override fun getJsonLibSupportPropertyBlockString(rawPropertyName: String, propertyType: String): String {
2523
val moShijsonSupportPropertyBuilder = StringBuilder()
2624

27-
moShijsonSupportPropertyBuilder.append(indent.value)
25+
moShijsonSupportPropertyBuilder.append(getIndent())
2826

2927
moShijsonSupportPropertyBuilder.append(MoShiSupporter.propertyAnnotationFormat.format(rawPropertyName))
3028

src/main/kotlin/wu/seal/jsontokotlin/supporter/NoneSupporter.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ interface INoneLibSupporter {
2424

2525
object NoneSupporter : INoneLibSupporter {
2626

27-
private val indent = lazy { getIndent() }
2827

2928
override fun getNoneLibSupporterClassName(rawClassName: String):String {
3029
return ""
@@ -35,7 +34,7 @@ object NoneSupporter : INoneLibSupporter {
3534

3635
val blockBuilder = StringBuilder()
3736

38-
blockBuilder.append(indent.value)
37+
blockBuilder.append(getIndent())
3938
blockBuilder.append(KPropertyKeyword.get())
4039
blockBuilder.append(" ")
4140
blockBuilder.append(rawPropertyName)

src/main/kotlin/wu/seal/jsontokotlin/supporter/NoneWithCamelCaseSupporter.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import wu.seal.jsontokotlin.utils.getIndent
1414

1515
object NoneWithCamelCaseSupporter : INoneLibSupporter {
1616

17-
private val indent = lazy { getIndent() }
1817

1918
override fun getNoneLibSupporterClassName(rawClassName: String):String {
2019
return ""
@@ -25,7 +24,7 @@ object NoneWithCamelCaseSupporter : INoneLibSupporter {
2524

2625
val blockBuilder = StringBuilder()
2726

28-
blockBuilder.append(indent.value)
27+
blockBuilder.append(getIndent())
2928
blockBuilder.append(KPropertyKeyword.get())
3029
blockBuilder.append(" ")
3130
blockBuilder.append(KPropertyName.getName(rawPropertyName))

src/main/kotlin/wu/seal/jsontokotlin/test/TestConfig.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ object TestConfig {
5454

5555
enableMinimalAnnotation = false
5656

57+
indent = 4
58+
5759
}
5860

5961

src/test/kotlin/wu/seal/jsontokotlin/ConfigManagerTestHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import org.junit.Test
55
import wu.seal.jsontokotlin.test.TestConfig
66
import kotlin.reflect.KMutableProperty0
77

8-
object ConfigManagerTestHelper {
8+
class ConfigManagerTestHelper {
99

1010

1111
@Before

0 commit comments

Comments
 (0)