forked from fge/jackson-coreutils
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore JacksonUtils.asMap to returning mutable maps.
This was the behavior before commit 97eeb08 and apparently several json-schema-core tests rely on this behavior. Added a test.
- Loading branch information
Showing
2 changed files
with
51 additions
and
4 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
48 changes: 48 additions & 0 deletions
48
src/test/java/com/github/fge/jackson/JacksonUtilsTest.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,48 @@ | ||
/* | ||
* Copyright (c) 2014, Francis Galiegue ([email protected]) | ||
* | ||
* This software is dual-licensed under: | ||
* | ||
* - the Lesser General Public License (LGPL) version 3.0 or, at your option, any | ||
* later version; | ||
* - the Apache Software License (ASL) version 2.0. | ||
* | ||
* The text of this file and of both licenses is available at the root of this | ||
* project or, if you have the jar distribution, in directory META-INF/, under | ||
* the names LGPL-3.0.txt and ASL-2.0.txt respectively. | ||
* | ||
* Direct link to the sources: | ||
* | ||
* - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt | ||
* - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt | ||
*/ | ||
|
||
package com.github.fge.jackson; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.JsonNodeFactory; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import static org.testng.Assert.*; | ||
|
||
public final class JacksonUtilsTest | ||
{ | ||
private JsonNode testData; | ||
|
||
@BeforeClass | ||
public void initData() | ||
throws IOException | ||
{ | ||
testData = JsonLoader.fromResource("/testfile.json"); | ||
} | ||
|
||
@Test() | ||
public void asMapIsMutable() { | ||
Map<String, JsonNode> map = JacksonUtils.asMap(testData.required(0)); | ||
map.remove("reference"); | ||
} | ||
} |