# Gson failure in end-to-end tests

DevFeed: [Gson failure in end-to-end tests](<https://devfeed.tech/articles/gson-failure-in-end-to-end-tests-27330.md>)

Original publisher: [Read original article](<https://blog.pchudzik.com/202201/gson-fail/>)

Published: 2022-01-23T00:00:00Z

Content type: article

Language: en

Sources: [Paweł Chudzik](<https://devfeed.tech/sources/pawe-chudzik.md>)

Topics: [Gson](<https://devfeed.tech/topics/gson.md>), [Java](<https://devfeed.tech/topics/java.md>), [JSON](<https://devfeed.tech/topics/json.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Jackson](<https://devfeed.tech/topics/jackson.md>)

Tags: [e2e](<https://devfeed.tech/tags/e2e.md>), [enum](<https://devfeed.tech/tags/enum.md>), [gson](<https://devfeed.tech/tags/gson.md>), [jackson](<https://devfeed.tech/tags/jackson.md>), [java](<https://devfeed.tech/tags/java.md>), [json](<https://devfeed.tech/tags/json.md>), [tests](<https://devfeed.tech/tags/tests.md>), [work](<https://devfeed.tech/tags/work.md>)

## AI overview

This article explains that Gson can silently ignore JSON deserialization problems, such as an unknown enum value, allowing end-to-end tests to pass even when an API contract is broken. It contrasts this behavior with Jackson and describes migrating tests from Gson to Jackson.

## Source excerpt

Using Gson in your e2e tests might result in tests passing even when contract is broken. Gson is quite imprecise when it comes to deserializing objects from json. Is there any difference between an enum and a string? Is there any difference between s string and a number? Using Java you might answer: sure there is. Even when talking about JSON you'll answer: yeah there is a difference. But for GSON? Meh whatever. Read more