forked from eclipse-ee4j/jaxb-ri
-
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.
[eclipse-ee4j#1695] Fix parsing of 'tru...' values inconsistent to tr…
…ue boolean impl now has same results as api but returning null instead of exception according to jakartaee/jaxb-api#240
- Loading branch information
1 parent
57ebae1
commit 70e116f
Showing
2 changed files
with
65 additions
and
9 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
56 changes: 56 additions & 0 deletions
56
jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/DatatypeConverterImplTest.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,56 @@ | ||
/* | ||
* Copyright (c) 2023, 2023 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Distribution License v. 1.0, which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
package org.glassfish.jaxb.runtime; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class DatatypeConverterImplTest { | ||
|
||
@Test | ||
public void testParseBoolean() { | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean(null)); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("11")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("1A")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("non")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("fals")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("falses")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("false s")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("falst")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("tru")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("trux")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("truu")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("truxx")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("truth")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("truelle")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("truec")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("true c")); | ||
Assert.assertEquals(null, DatatypeConverterImpl._parseBoolean("oui")); | ||
|
||
Assert.assertEquals(false, DatatypeConverterImpl._parseBoolean("0")); | ||
Assert.assertEquals(false, DatatypeConverterImpl._parseBoolean(" 0")); | ||
Assert.assertEquals(false, DatatypeConverterImpl._parseBoolean(" 0 ")); | ||
Assert.assertEquals(false, DatatypeConverterImpl._parseBoolean("0 ")); | ||
Assert.assertEquals(true, DatatypeConverterImpl._parseBoolean("1")); | ||
Assert.assertEquals(true, DatatypeConverterImpl._parseBoolean(" 1")); | ||
Assert.assertEquals(true, DatatypeConverterImpl._parseBoolean(" 1 ")); | ||
Assert.assertEquals(true, DatatypeConverterImpl._parseBoolean("1 ")); | ||
Assert.assertEquals(false, DatatypeConverterImpl._parseBoolean("false")); | ||
Assert.assertEquals(false, DatatypeConverterImpl._parseBoolean(" false")); | ||
Assert.assertEquals(false, DatatypeConverterImpl._parseBoolean("false ")); | ||
Assert.assertEquals(false, DatatypeConverterImpl._parseBoolean(" false ")); | ||
Assert.assertEquals(true, DatatypeConverterImpl._parseBoolean("true")); | ||
Assert.assertEquals(true, DatatypeConverterImpl._parseBoolean(" true")); | ||
Assert.assertEquals(true, DatatypeConverterImpl._parseBoolean("true ")); | ||
Assert.assertEquals(true, DatatypeConverterImpl._parseBoolean(" true ")); | ||
} | ||
} |