Skip to content

Commit

Permalink
Improve formatting of GH145 test
Browse files Browse the repository at this point in the history
  • Loading branch information
dinomite committed Mar 1, 2021
1 parent 8a01403 commit b5285aa
Showing 1 changed file with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,29 @@ class TestGithub145 {
@JsonProperty("preName") val preName: String,
@JsonProperty("lastName") val lastName: String
) {
constructor(preNameAndLastName:String): this(preNameAndLastName.substringBefore(","),preNameAndLastName.substringAfter(","))
constructor(preNameAndLastName: String) : this(
preNameAndLastName.substringBefore(","),
preNameAndLastName.substringAfter(",")
)
}

val objectMapper = ObjectMapper()
val personA = objectMapper.readValue("""{"preName":"TestPreName","lastName":"TestLastname"}""", Person1::class.java)
val personA =
objectMapper.readValue("""{"preName":"TestPreName","lastName":"TestLastname"}""", Person1::class.java)
val personB = objectMapper.readValue(""""TestPreName,TestLastname"""", Person1::class.java)
}

@Test
fun testPersonGood2() {
class PersonGood1(@JsonProperty("preName") val preName:String, @JsonProperty("lastName") val lastName:String)
{
@JsonCreator constructor(preNameAndLastName:String): this(preNameAndLastName.substringBefore(","),preNameAndLastName.substringAfter(","))
class PersonGood1(
@JsonProperty("preName") val preName: String,
@JsonProperty("lastName") val lastName: String
) {
@JsonCreator
constructor(preNameAndLastName: String) : this(
preNameAndLastName.substringBefore(","),
preNameAndLastName.substringAfter(",")
)
}

val personGood1String = objectMapper.readValue<PersonGood1>(""""TestPreName,TestLastname"""")
Expand All @@ -39,9 +49,12 @@ class TestGithub145 {

@Test
fun testPersonGood3() {
class PersonGood2(val preName:String, val lastName:String)
{
@JsonCreator constructor(preNameAndLastName:String): this(preNameAndLastName.substringBefore(","),preNameAndLastName.substringAfter(","))
class PersonGood2(val preName: String, val lastName: String) {
@JsonCreator
constructor(preNameAndLastName: String) : this(
preNameAndLastName.substringBefore(","),
preNameAndLastName.substringAfter(",")
)
}

val personGood2String = objectMapper.readValue<PersonGood2>(""""TestPreName,TestLastname"""")
Expand All @@ -52,8 +65,8 @@ class TestGithub145 {
@Test
fun testPersonGood4() {
class PersonGood4(preNameAndLastName: String) {
val preName:String
val lastName:String
val preName: String
val lastName: String

init {
this.preName = preNameAndLastName.substringBefore(",")
Expand Down Expand Up @@ -102,6 +115,7 @@ class TestGithub145 {
}
}
}

@Test
fun testPersonGood6() {
val personGood6String = objectMapper.readValue<PersonGood6>(""""TestPreName,TestLastname"""")
Expand All @@ -124,6 +138,7 @@ class TestGithub145 {
}
}
}

@Test
fun testPersonGood7() {
val personGood7String = objectMapper.readValue<PersonGood7>(""""TestPreName,TestLastname"""")
Expand Down

0 comments on commit b5285aa

Please sign in to comment.