You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/11/08 13:33:07 UTC

groovy git commit: Move `GProperties` to its own project for the time being

Repository: groovy
Updated Branches:
  refs/heads/master 7a41f0efd -> 603d6e711


Move `GProperties` to its own project for the time being


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/603d6e71
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/603d6e71
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/603d6e71

Branch: refs/heads/master
Commit: 603d6e711776b88f791447f1ba2a7a16f824c971
Parents: 7a41f0e
Author: Daniel Sun <su...@apache.org>
Authored: Thu Nov 8 21:30:50 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Thu Nov 8 21:32:36 2018 +0800

----------------------------------------------------------------------
 src/main/groovy/groovy/util/GProperties.groovy  | 352 -------------------
 .../groovy/util/gproperties.properties          |  43 ---
 .../groovy/util/gproperties_import.properties   |  21 --
 .../groovy/util/gproperties_import2.properties  |  20 --
 .../groovy/util/gproperties_import3.properties  |  20 --
 src/test/groovy/util/GPropertiesTest.groovy     | 344 ------------------
 6 files changed, 800 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/603d6e71/src/main/groovy/groovy/util/GProperties.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/util/GProperties.groovy b/src/main/groovy/groovy/util/GProperties.groovy
deleted file mode 100644
index d3b08c1..0000000
--- a/src/main/groovy/groovy/util/GProperties.groovy
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package groovy.util
-
-import groovy.transform.CompileStatic
-
-import java.util.regex.Pattern
-
-/**
- * Represents an enhanced properties, which supports interpolating in the values and importing other properties in classpath
- *
- * Usage:
- * 1) Interpolating with {...}, e.g.
- * <pre>
- *      # gproperties.properties
- *      groovy.greeting=Hello
- *      some.name=Daniel
- *      greeting.daniel={groovy.greeting},{some.name}
- *
- *      // groovy script
- *      def gp = new GProperties()
- *      gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
- *      assert 'Hello,Daniel' == gp.getProperty('greeting.daniel')
- * </pre>
- *
- * 2) Importing with import.properties, e.g.
- * <pre>
- *      # gproperties.properties
- *      import.properties=/groovy/util/gproperties_import.properties,/groovy/util/gproperties_import2.properties
- *      greeting.daniel={groovy.greeting},{some.name}
- *
- *      # gproperties_import.properties
- *      groovy.greeting=Hello
- *
- *      # gproperties_import2.properties
- *      some.name=Daniel
- *
- *      // groovy script
- *      def gp = new GProperties()
- *      gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
- *      assert 'Hello,Daniel' == gp.getProperty('greeting.daniel')
- * </pre>
- *
- * 3) Escaping with {{...}}, e.g.
- * <pre>
- *      # gproperties.properties
- *      greeting.daniel={{groovy.greeting}},{{some.name}}
- *
- *      // groovy script
- *      def gp = new GProperties()
- *      gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
- *      assert '{groovy.greeting},{some.name}' == gp.getProperty('greeting.daniel')
- * </pre>
- *
- * 4) Getting property with the specified type(integer, long, boolean, etc.), e.g.
- * <pre>
- *      # gproperties.properties
- *      property.integer=1104
- *
- *      // groovy script
- *      def gp = new GProperties()
- *      gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
- *      assert new Integer(1104) == gp.getInteger('property.integer')
- * </pre>
- *
- * @since 3.0.0
- */
-@CompileStatic
-class GProperties extends Properties {
-    private static final long serialVersionUID = 6112578636029876860L
-    public static final String IMPORT_PROPERTIES_KEY = 'import.properties'
-    private static final Pattern INTERPOLATE_PATTERN = Pattern.compile(/([{]+)(.*?)([}]+)/)
-    private static final String LEFT_CURLY_BRACE = '{'
-    private static final String RIGHT_CURLY_BRACE = '}'
-    private static final String COMMA = ','
-    private final List<Properties> importPropertiesList = new LinkedList<>()
-
-    GProperties() {
-        this((Properties) null)
-    }
-
-    GProperties(Reader reader) throws IOException {
-        this()
-        load(reader)
-    }
-
-    GProperties(CharSequence content) {
-        this()
-        load(new StringReader(content.toString()))
-    }
-
-    GProperties(InputStream inStream) throws IOException {
-        this()
-        load(inStream)
-    }
-
-    GProperties(Properties defaults) {
-        super(defaults)
-    }
-
-    GProperties(Properties defaults, Reader reader) throws IOException {
-        this(defaults)
-        load(reader)
-    }
-
-    GProperties(Properties defaults, CharSequence content) {
-        this(defaults)
-        load(new StringReader(content.toString()))
-    }
-
-    GProperties(Properties defaults, InputStream inStream) throws IOException {
-        this(defaults)
-        load(inStream)
-    }
-
-    @Override
-    String getProperty(String key) {
-        String value = super.getProperty(key)
-
-        if (null == value) {
-            for (Properties importProperties : importPropertiesList) {
-                value = importProperties.getProperty(key)
-
-                if (null != value) {
-                    break
-                }
-            }
-        }
-
-        if (null == value) {
-            return value
-        }
-
-        interpolate(value)
-    }
-
-    private String interpolate(String value) {
-        value.replaceAll(INTERPOLATE_PATTERN) { String _0, String _1, String _2, String _3 ->
-            int leftCnt = _1.count(LEFT_CURLY_BRACE)
-            int rightCnt = _3.count(RIGHT_CURLY_BRACE)
-            int minCnt = Math.min(leftCnt, rightCnt)
-            int escapeCnt = (minCnt / 2) as int
-
-            String left = LEFT_CURLY_BRACE * (escapeCnt + (leftCnt - minCnt))
-            String right = RIGHT_CURLY_BRACE * (escapeCnt + (rightCnt - minCnt))
-
-            if (minCnt % 2 == 0) {
-                return "${left}${_2}${right}"
-            }
-
-            def p = this.getProperty(_2.trim())
-
-            "${left}${null == p ? _0 : p}${right}"
-        }
-    }
-
-    Character getCharacter(String key) {
-        getPropertyWithType(key) { String p ->
-            if (!p || p.length() > 1) {
-                throw new IllegalArgumentException("Invalid character: ${p}")
-            }
-
-            Character.valueOf(p as char)
-        }
-    }
-
-    Character getCharacter(String key, Character defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getCharacter(key)
-        }
-    }
-
-    Byte getByte(String key) {
-        getPropertyWithType(key) { String p ->
-            Byte.valueOf(p)
-        }
-    }
-
-    Byte getByte(String key, Byte defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getByte(key)
-        }
-    }
-
-    Short getShort(String key) {
-        getPropertyWithType(key) { String p ->
-            Short.valueOf(p)
-        }
-    }
-
-    Short getShort(String key, Short defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getShort(key)
-        }
-    }
-
-    Integer getInteger(String key) {
-        getPropertyWithType(key) { String p ->
-            Integer.valueOf(p)
-        }
-    }
-
-    Integer getInteger(String key, Integer defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getInteger(key)
-        }
-    }
-
-    Long getLong(String key) {
-        getPropertyWithType(key) { String p ->
-            Long.valueOf(p)
-        }
-    }
-
-    Long getLong(String key, Long defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getLong(key)
-        }
-    }
-
-    Float getFloat(String key) {
-        getPropertyWithType(key) { String p ->
-            Float.valueOf(p)
-        }
-    }
-
-    Float getFloat(String key, Float defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getFloat(key)
-        }
-    }
-
-    Double getDouble(String key) {
-        getPropertyWithType(key) { String p ->
-            Double.valueOf(p)
-        }
-    }
-
-    Double getDouble(String key, Double defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getDouble(key)
-        }
-    }
-
-    Boolean getBoolean(String key) {
-        getPropertyWithType(key) { String p ->
-            Boolean.valueOf(p)
-        }
-    }
-
-    Boolean getBoolean(String key, Boolean defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getBoolean(key)
-        }
-    }
-
-    BigInteger getBigInteger(String key) {
-        getPropertyWithType(key) { String p ->
-            new BigInteger(p)
-        }
-    }
-
-    BigInteger getBigInteger(String key, BigInteger defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getBigInteger(key)
-        }
-    }
-
-    BigDecimal getBigDecimal(String key) {
-        getPropertyWithType(key) { String p ->
-            new BigDecimal(p)
-        }
-    }
-
-    BigDecimal getBigDecimal(String key, BigDecimal defaultValue) {
-        getDefaultIfAbsent(key, defaultValue) {
-            getBigDecimal(key)
-        }
-    }
-
-    @Override
-    synchronized void load(Reader reader) throws IOException {
-        reader.withReader {
-            super.load(it)
-            importPropertiesFromFiles()
-        }
-    }
-
-    @Override
-    synchronized void load(InputStream inStream) throws IOException {
-        inStream.withStream {
-            super.load(it)
-            importPropertiesFromFiles()
-        }
-    }
-
-    synchronized void importProperties(Properties properties) {
-        if (importPropertiesList.contains(properties)) {
-            return
-        }
-
-        importPropertiesList << properties
-    }
-
-    private void importPropertiesFromFiles() {
-        String importPropertiesPaths = super.getProperty(IMPORT_PROPERTIES_KEY)
-
-        if (!importPropertiesPaths?.trim()) {
-            return
-        }
-
-        importPropertiesPaths.split(COMMA).collect { it.trim() }.each { String importPropertiesPath ->
-            if (!importPropertiesPath) {
-                return
-            }
-
-            def inputstream = GProperties.getResourceAsStream(importPropertiesPath)
-
-            if (!inputstream) {
-                throw new IOException("${importPropertiesPath} does not exist")
-            }
-
-            importProperties(new GProperties(inputstream))
-        }
-    }
-
-    private <V> V getPropertyWithType(String key, Closure<V> c) {
-        def p = getProperty(key)
-        null == p ? null : c(p)
-    }
-
-    private <V> V getDefaultIfAbsent(String key, V defaultValue, Closure<V> c) {
-        def p = c(key)
-        null == p ? defaultValue : p
-    }
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/603d6e71/src/test-resources/groovy/util/gproperties.properties
----------------------------------------------------------------------
diff --git a/src/test-resources/groovy/util/gproperties.properties b/src/test-resources/groovy/util/gproperties.properties
deleted file mode 100644
index 33c0a2a..0000000
--- a/src/test-resources/groovy/util/gproperties.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-#
-
-import.properties=/groovy/util/gproperties_import.properties,/groovy/util/gproperties_import3.properties
-groovy.greeting={greeting.word},{some.name}
-groovy.greeting.with.smile={groovy.greeting} :)
-groovy.greeting.with.missing=Hello,{none} {0}
-groovy.greeting.with.escapes=Hello,{{some.name}}
-groovy.greeting.with.escapes2=Hello, curly brace {{}}
-groovy.greeting.with.escapes3=Hello,{{{some.name}}}
-groovy.greeting.with.escapes4=Hello,{{{some.name}}
-groovy.greeting.with.escapes5=Hello,{{some.name}}}
-groovy.greeting.with.escapes6=Hello,{{{{some.name}}}}
-groovy.greeting.with.escapes7=Hello,{{some.name}
-groovy.greeting.with.escapes8=Hello,{some.name}}
-property.character=a
-property.character.invalid=abc
-property.byte=1
-property.short=126
-property.integer=1104
-property.long=181104
-property.float=18.1104f
-property.double=18.1104d
-property.boolean=true
-property.biginteger=20181104
-property.bigdecimal=2018.1104
-property.empty=Hello,{}

http://git-wip-us.apache.org/repos/asf/groovy/blob/603d6e71/src/test-resources/groovy/util/gproperties_import.properties
----------------------------------------------------------------------
diff --git a/src/test-resources/groovy/util/gproperties_import.properties b/src/test-resources/groovy/util/gproperties_import.properties
deleted file mode 100644
index 7016e97..0000000
--- a/src/test-resources/groovy/util/gproperties_import.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-#
-import.properties=/groovy/util/gproperties_import2.properties
-some.name=Daniel
-greeting.daniel={greeting.word},{some.name}

http://git-wip-us.apache.org/repos/asf/groovy/blob/603d6e71/src/test-resources/groovy/util/gproperties_import2.properties
----------------------------------------------------------------------
diff --git a/src/test-resources/groovy/util/gproperties_import2.properties b/src/test-resources/groovy/util/gproperties_import2.properties
deleted file mode 100644
index 99a9f7a..0000000
--- a/src/test-resources/groovy/util/gproperties_import2.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-#
-
-greeting.word=Hello

http://git-wip-us.apache.org/repos/asf/groovy/blob/603d6e71/src/test-resources/groovy/util/gproperties_import3.properties
----------------------------------------------------------------------
diff --git a/src/test-resources/groovy/util/gproperties_import3.properties b/src/test-resources/groovy/util/gproperties_import3.properties
deleted file mode 100644
index 616c9a4..0000000
--- a/src/test-resources/groovy/util/gproperties_import3.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-#
-
-greeting.word2=Hi

http://git-wip-us.apache.org/repos/asf/groovy/blob/603d6e71/src/test/groovy/util/GPropertiesTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/util/GPropertiesTest.groovy b/src/test/groovy/util/GPropertiesTest.groovy
deleted file mode 100644
index 805d015..0000000
--- a/src/test/groovy/util/GPropertiesTest.groovy
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package groovy.util
-
-class GPropertiesTest extends GroovyTestCase {
-    void testImportProperties() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert '/groovy/util/gproperties_import.properties,/groovy/util/gproperties_import3.properties' == gp.getProperty('import.properties')
-        assert 'Daniel' == gp.getProperty('some.name')
-        assert 'Hello' == gp.getProperty('greeting.word')
-        assert 'Hi' == gp.getProperty('greeting.word2')
-    }
-
-    void testImportProperties2() {
-        def gp = new GProperties()
-        gp.importProperties(System.getProperties())
-
-        // JAVA 8'S CLASS VERSION IS 52.0
-        assert new BigDecimal('52.0').compareTo(gp.getBigDecimal('java.class.version')) <= 0
-    }
-
-    void testInterpolate() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,Daniel' == gp.getProperty('groovy.greeting')
-    }
-
-    void testInterpolate2() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,Daniel :)' == gp.getProperty('groovy.greeting.with.smile')
-    }
-
-    void testInterpolate3() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,{none} {0}' == gp.getProperty('groovy.greeting.with.missing')
-    }
-
-    void testInterpolate4() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,Daniel' == gp.getProperty('greeting.daniel')
-    }
-
-    void testInterpolate5() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert '''Hello,Daniel''' == gp.getProperty('greeting.daniel')
-    }
-
-    void testInterpolate6() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert '''Hello,{}''' == gp.getProperty('property.empty')
-    }
-
-    void testEscape() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,{some.name}' == gp.getProperty('groovy.greeting.with.escapes')
-    }
-
-    void testEscape2() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello, curly brace {}' == gp.getProperty('groovy.greeting.with.escapes2')
-    }
-
-    void testEscape3() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,{Daniel}' == gp.getProperty('groovy.greeting.with.escapes3')
-    }
-
-    void testEscape4() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,{{some.name}' == gp.getProperty('groovy.greeting.with.escapes4')
-    }
-
-    void testEscape5() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,{some.name}}' == gp.getProperty('groovy.greeting.with.escapes5')
-    }
-
-    void testEscape6() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,{{some.name}}' == gp.getProperty('groovy.greeting.with.escapes6')
-    }
-
-    void testEscape7() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,{Daniel' == gp.getProperty('groovy.greeting.with.escapes7')
-    }
-
-    void testEscape8() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello,Daniel}' == gp.getProperty('groovy.greeting.with.escapes8')
-    }
-
-    void testGetCharacter() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Character('a' as char) == gp.getCharacter('property.character')
-        assert null == gp.getCharacter('property.character.missing')
-
-        try {
-            gp.getCharacter('property.character.invalid')
-            assert false
-        } catch (IllegalArgumentException e) {
-            assert e.message.contains('Invalid character')
-        }
-    }
-
-    void testGetCharacterWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Character('a' as char) == gp.getCharacter('property.character', new Character('b' as char))
-        assert new Character('b' as char) == gp.getCharacter('property.character.missing', new Character('b' as char))
-    }
-
-    void testGetByte() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Byte(1 as byte) == gp.getByte('property.byte')
-        assert null == gp.getByte('property.byte.missing')
-    }
-
-    void testGetByteWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Byte(1 as byte) == gp.getByte('property.byte', new Byte(2 as byte))
-        assert new Byte(2 as byte) == gp.getByte('property.byte.missing', new Byte(2 as byte))
-    }
-
-    void testGetShort() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Short(126 as short) == gp.getShort('property.short')
-        assert null == gp.getShort('property.short.missing')
-    }
-
-    void testGetShortWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Short(126 as short) == gp.getShort('property.short', new Short(125 as short))
-        assert new Short(125 as short) == gp.getShort('property.short.missing', new Short(125 as short))
-    }
-
-    void testGetInteger() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Integer(1104) == gp.getInteger('property.integer')
-        assert null == gp.getInteger('property.integer.missing')
-    }
-
-    void testGetIntegerWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Integer(1104) == gp.getInteger('property.integer', new Integer(1101))
-        assert new Integer(1101) == gp.getInteger('property.integer.missing', new Integer(1101))
-    }
-
-    void testGetLong() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Long(181104) == gp.getLong('property.long')
-        assert null == gp.getLong('property.long.missing')
-    }
-
-    void testGetLongWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Long(181104) == gp.getLong('property.long', new Long(181101))
-        assert new Long(181101) == gp.getLong('property.long.missing', new Long(181101))
-    }
-
-    void testGetFloat() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Float(18.1104f) == gp.getFloat('property.float')
-        assert null == gp.getFloat('property.float.missing')
-    }
-
-    void testGetFloatWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Float(18.1104f) == gp.getFloat('property.float', new Float(18.1101f))
-        assert new Float(18.1101f) == gp.getFloat('property.float.missing', new Float(18.1101f))
-    }
-
-    void testGetDouble() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Double(18.1104d) == gp.getDouble('property.double')
-        assert null == gp.getDouble('property.double.missing')
-    }
-
-    void testGetDoubleWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Double(18.1104d) == gp.getDouble('property.double', new Double(18.1101d))
-        assert new Double(18.1101d) == gp.getDouble('property.double.missing', new Double(18.1101d))
-    }
-
-    void testGetBoolean() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Boolean(true) == gp.getBoolean('property.boolean')
-        assert null == gp.getBoolean('property.boolean.missing')
-    }
-
-    void testGetBooleanWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new Boolean(true) == gp.getBoolean('property.boolean', new Boolean(false))
-        assert new Boolean(false) == gp.getBoolean('property.boolean.missing', new Boolean(false))
-    }
-
-    void testGetBigInteger() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new BigInteger(20181104) == gp.getBigInteger('property.biginteger')
-        assert null == gp.getBigInteger('property.biginteger.missing')
-    }
-
-    void testGetBigIntegerWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new BigInteger(20181104) == gp.getBigInteger('property.biginteger', new BigInteger(20181101))
-        assert new BigInteger(20181101) == gp.getBigInteger('property.biginteger.missing', new BigInteger(20181101))
-    }
-
-    void testGetBigDecimal() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new BigDecimal('2018.1104') == gp.getBigDecimal('property.bigdecimal')
-        assert null == gp.getBigDecimal('property.bigdecimal.missing')
-    }
-
-    void testGetBigDecimalWithDefault() {
-        def gp = new GProperties()
-        gp.load(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert new BigDecimal('2018.1104') == gp.getBigDecimal('property.bigdecimal', new BigDecimal('2018.1101'))
-        assert new BigDecimal('2018.1101') == gp.getBigDecimal('property.bigdecimal.missing', new BigDecimal('2018.1101'))
-    }
-
-    void testConstructor() {
-        def gp = new GProperties(new InputStreamReader(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties')))
-
-        assert 'Hello' == gp.getProperty('greeting.word')
-    }
-
-    void testConstructor2() {
-        def gp = new GProperties(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Hello' == gp.getProperty('greeting.word')
-    }
-
-    void testConstructor3() {
-        def gp = new GProperties(new Properties(['property.missing': 'Missing']), new InputStreamReader(GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties')))
-
-        assert 'Missing' == gp.getProperty('property.missing')
-    }
-
-    void testConstructor4() {
-        def gp = new GProperties(new Properties(['property.missing': 'Missing']), GPropertiesTest.getResourceAsStream('/groovy/util/gproperties.properties'))
-
-        assert 'Missing' == gp.getProperty('property.missing')
-    }
-
-    void testConstructor5() {
-        def gp = new GProperties('''
-greeting.world=Hello,world!
-        ''')
-
-        assert 'Hello,world!' == gp.getProperty('greeting.world')
-    }
-
-    void testConstructor6() {
-        def gp = new GProperties(new Properties(['property.missing': 'Missing']), '''
-greeting.world=Hello,world!
-        ''')
-
-        assert 'Missing' == gp.getProperty('property.missing')
-    }
-}