forked from Azure/azure-sdk-for-java
-
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.
Shim ObjectMapper and add diagnostic version info to exceptions (Azur…
…e#23441) * Shim for ObjectMapper and use shim within azure-core Co-authored-by: Srikanta <[email protected]>
- Loading branch information
Showing
64 changed files
with
1,481 additions
and
502 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
34 changes: 34 additions & 0 deletions
34
.../src/test/java/com/azure/core/implementation/jackson/UnsupportedJacksonVersionsTests.java
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,34 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.core.implementation.jackson; | ||
|
||
import com.azure.core.util.CoreUtils; | ||
import com.azure.core.util.serializer.JacksonAdapter; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
public class UnsupportedJacksonVersionsTests { | ||
@Test | ||
public void testUnsupportedVersion() { | ||
String jacksonVersionString = ObjectMapper.class.getPackage().getImplementationVersion(); | ||
String azureCoreVersion = CoreUtils | ||
.getProperties("azure-core.properties") | ||
.getOrDefault("version", null); | ||
|
||
JacksonVersion version = JacksonVersion.getInstance(); | ||
String helpInfo = version.getHelpInfo(); | ||
assertTrue(helpInfo.contains("jackson-annotations=" + jacksonVersionString)); | ||
assertTrue(helpInfo.contains("jackson-core=" + jacksonVersionString)); | ||
assertTrue(helpInfo.contains("jackson-databind=" + jacksonVersionString)); | ||
assertTrue(helpInfo.contains("jackson-dataformat-xml=" + jacksonVersionString)); | ||
assertTrue(helpInfo.contains("jackson-datatype-jsr310=" + jacksonVersionString)); | ||
assertTrue(helpInfo.contains("azure-core=" + azureCoreVersion)); | ||
|
||
Error error = assertThrows(Error.class, () -> new JacksonAdapter()); | ||
assertTrue(error.getMessage().contains(helpInfo)); | ||
} | ||
} |
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
Oops, something went wrong.