-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: JsonCodec fail on unknown & missing property (#145)
* refactor: JsonCodec fail on Unknown property * refactor: JsonCodec Fail On Missing properties * docs: version 0.4.5 0> 0.4.6
- Loading branch information
Showing
4 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.rooftop.netx.ground | ||
|
||
import com.fasterxml.jackson.annotation.JsonAutoDetect | ||
import com.fasterxml.jackson.annotation.JsonCreator | ||
import com.fasterxml.jackson.annotation.PropertyAccessor | ||
import com.fasterxml.jackson.databind.DeserializationFeature | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule | ||
import com.fasterxml.jackson.module.kotlin.KotlinModule | ||
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule | ||
import io.kotest.assertions.throwables.shouldThrowAny | ||
import io.kotest.core.spec.style.StringSpec | ||
import io.kotest.extensions.spring.SpringExtension | ||
import org.rooftop.netx.meta.EnableSaga | ||
import org.rooftop.netx.redis.RedisContainer | ||
import org.springframework.test.context.ContextConfiguration | ||
import org.springframework.test.context.TestPropertySource | ||
|
||
@EnableSaga | ||
@TestPropertySource("classpath:application.properties") | ||
@ContextConfiguration(classes = [RedisContainer::class]) | ||
class GroudTest( | ||
private val netxObjectMapper: ObjectMapper, | ||
) : StringSpec({ | ||
|
||
extension(SpringExtension) | ||
|
||
"ObjectMapper UnknownProperty Test" { | ||
val request = "{ \"name\": \"xb\" }" | ||
|
||
shouldThrowAny { | ||
netxObjectMapper.readValue(request, Target::class.java) | ||
} | ||
} | ||
}) { | ||
|
||
data class Target( | ||
val id: Long, | ||
val name: String, | ||
val isSuccess: Boolean, | ||
) | ||
} |