Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert "previously-failing" tests into "passing" #849

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fasterxml.jackson.module.kotlin.test.github.failing
package com.fasterxml.jackson.module.kotlin.test.github;

import com.fasterxml.jackson.annotation.JsonUnwrapped
import com.fasterxml.jackson.databind.exc.InvalidDefinitionException
Expand All @@ -19,10 +19,8 @@ class TestGithub50 {
@Test
fun testGithub50UnwrappedError() {
val json = """{"firstName":"John","lastName":"Smith","position":"Manager"}"""
expectFailure<InvalidDefinitionException>("GitHub #50 has been fixed!") {
val obj: Employee = jacksonObjectMapper().readValue(json)
assertEquals(Name("John", "Smith"), obj.name)
assertEquals("Manager", obj.position)
}
val obj: Employee = jacksonObjectMapper().readValue(json)
assertEquals(Name("John", "Smith"), obj.name)
assertEquals("Manager", obj.position)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.fasterxml.jackson.module.kotlin.test.github
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.annotation.JsonUnwrapped
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.exc.InvalidDefinitionException
import com.fasterxml.jackson.module.kotlin.*
import org.junit.Before
import org.junit.Test
Expand Down Expand Up @@ -67,9 +66,12 @@ class TestGithub56 {
assertEquals(validJson, result)
}

@Test(expected = InvalidDefinitionException::class)
fun deserializesWithError() {
mapper.readValue<TestGalleryWidget_BAD>(validJson)
@Test
fun deserializesSuccessful() {
val obj = mapper.readValue<TestGalleryWidget_BAD>(validJson)
assertEquals("widgetReferenceId", obj.widgetReferenceId)
assertEquals(gallery, obj.gallery)

}

@Test
Expand Down