Merge pull request #301 from aguibert/propertynametest
Add test scenario for colliding property with lowercase strategy
diff --git a/README.md b/README.md
index b599345..c6d7f2e 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,10 @@
+# Eclipse Yasson
+
+[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.eclipse%22%20a%3A%22yasson%22)
+[](https://oss.sonatype.org/content/repositories/snapshots/org/eclipse/yasson/)
[](https://travis-ci.org/eclipse-ee4j/yasson)
[](https://opensource.org/licenses/EPL-1.0)
-[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.eclipse%22%20a%3A%22yasson%22)
-# Yasson
Yasson is a Java framework which provides a standard binding layer between Java classes and JSON documents. This is similar to what JAXB is doing in the XML world. Yasson is an official reference implementation of JSON Binding ([JSR-367](https://jcp.org/en/jsr/detail?id=367)).
It defines a **default mapping** algorithm for converting existing Java classes to JSON suitable for the most cases:
diff --git a/src/test/java/org/eclipse/yasson/customization/JsonbPropertyTest.java b/src/test/java/org/eclipse/yasson/customization/JsonbPropertyTest.java
index e35ed1a..4a350b6 100644
--- a/src/test/java/org/eclipse/yasson/customization/JsonbPropertyTest.java
+++ b/src/test/java/org/eclipse/yasson/customization/JsonbPropertyTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -152,6 +152,22 @@
}
}
+
+ @Test
+ public void testConflictingWithLowercaseStrategy() {
+ // scenario raised by user here: https://github.com/eclipse-ee4j/yasson/issues/296
+ Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES));
+ assertEquals("{\"url\":\"http://foo.com\"}",
+ jsonb.toJson(new ConflictingIfLowercase()));
+ }
+
+ public static class ConflictingIfLowercase {
+ private String url = "foo.com";
+
+ public String getURL() {
+ return "http://" + url;
+ }
+ }
public static class NonConflictingProperties {
private String doi;