Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X 4222acbd5 -> 1b1e9f0ba
Move java test files to "test" directory Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/1b1e9f0b Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/1b1e9f0b Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/1b1e9f0b Branch: refs/heads/GROOVY_2_5_X Commit: 1b1e9f0ba159e4efb3932f697ed6cc494d34884b Parents: 4222acb Author: danielsun1106 <[email protected]> Authored: Sun Mar 25 19:29:34 2018 +0800 Committer: danielsun1106 <[email protected]> Committed: Sun Mar 25 19:29:34 2018 +0800 ---------------------------------------------------------------------- .../java/org/apache/groovy/util/MapsTest.java | 49 -------------------- .../runtime/EncodingGroovyMethodsTest.java | 36 -------------- src/test/org/apache/groovy/util/MapsTest.java | 49 ++++++++++++++++++++ .../runtime/EncodingGroovyMethodsTest.java | 36 ++++++++++++++ 4 files changed, 85 insertions(+), 85 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/1b1e9f0b/src/test/java/org/apache/groovy/util/MapsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/groovy/util/MapsTest.java b/src/test/java/org/apache/groovy/util/MapsTest.java deleted file mode 100644 index 6a00785..0000000 --- a/src/test/java/org/apache/groovy/util/MapsTest.java +++ /dev/null @@ -1,49 +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 org.apache.groovy.util; - -import org.junit.Assert; -import org.junit.Test; - -import java.util.Map; - -public class MapsTest { - - @Test - public void inverse() { - Map<String, Integer> map = Maps.of("a", 1, "b", 2, "c", 3); - Map<Integer, String> inversedMap = Maps.inverse(map); - - Assert.assertEquals(map.size(), inversedMap.size()); - for (Map.Entry<Integer, String> entry : inversedMap.entrySet()) { - Assert.assertEquals(map.get(entry.getValue()), entry.getKey()); - } - - try { - Maps.inverse(Maps.of("a", 1, "b", 2, "c", 2)); - } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("duplicated key found: 2")); - } - - Map<Integer, String> inversedMap2 = Maps.inverse(Maps.of("a", 1, "b", 2, "c", 2), true); - Assert.assertEquals(2, inversedMap2.size()); - Assert.assertEquals("a", inversedMap2.get(1)); - Assert.assertEquals("c", inversedMap2.get(2)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/groovy/blob/1b1e9f0b/src/test/java/org/codehaus/groovy/runtime/EncodingGroovyMethodsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/codehaus/groovy/runtime/EncodingGroovyMethodsTest.java b/src/test/java/org/codehaus/groovy/runtime/EncodingGroovyMethodsTest.java deleted file mode 100644 index 20c0897..0000000 --- a/src/test/java/org/codehaus/groovy/runtime/EncodingGroovyMethodsTest.java +++ /dev/null @@ -1,36 +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 org.codehaus.groovy.runtime; - -import org.junit.Assert; -import org.junit.Test; - -public class EncodingGroovyMethodsTest { - @Test - public void md5() throws Exception { - Assert.assertEquals("e99a18c428cb38d5f260853678922e03", EncodingGroovyMethods.md5("abc123")); - Assert.assertEquals("e99a18c428cb38d5f260853678922e03", EncodingGroovyMethods.md5("abc123".getBytes("UTF-8"))); - } - - @Test - public void digest() throws Exception { - Assert.assertEquals("e99a18c428cb38d5f260853678922e03", EncodingGroovyMethods.digest("abc123", "MD5")); - Assert.assertEquals("e99a18c428cb38d5f260853678922e03", EncodingGroovyMethods.digest("abc123".getBytes("UTF-8"), "MD5")); - } -} http://git-wip-us.apache.org/repos/asf/groovy/blob/1b1e9f0b/src/test/org/apache/groovy/util/MapsTest.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/groovy/util/MapsTest.java b/src/test/org/apache/groovy/util/MapsTest.java new file mode 100644 index 0000000..6a00785 --- /dev/null +++ b/src/test/org/apache/groovy/util/MapsTest.java @@ -0,0 +1,49 @@ +/* + * 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 org.apache.groovy.util; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.Map; + +public class MapsTest { + + @Test + public void inverse() { + Map<String, Integer> map = Maps.of("a", 1, "b", 2, "c", 3); + Map<Integer, String> inversedMap = Maps.inverse(map); + + Assert.assertEquals(map.size(), inversedMap.size()); + for (Map.Entry<Integer, String> entry : inversedMap.entrySet()) { + Assert.assertEquals(map.get(entry.getValue()), entry.getKey()); + } + + try { + Maps.inverse(Maps.of("a", 1, "b", 2, "c", 2)); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("duplicated key found: 2")); + } + + Map<Integer, String> inversedMap2 = Maps.inverse(Maps.of("a", 1, "b", 2, "c", 2), true); + Assert.assertEquals(2, inversedMap2.size()); + Assert.assertEquals("a", inversedMap2.get(1)); + Assert.assertEquals("c", inversedMap2.get(2)); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/groovy/blob/1b1e9f0b/src/test/org/codehaus/groovy/runtime/EncodingGroovyMethodsTest.java ---------------------------------------------------------------------- diff --git a/src/test/org/codehaus/groovy/runtime/EncodingGroovyMethodsTest.java b/src/test/org/codehaus/groovy/runtime/EncodingGroovyMethodsTest.java new file mode 100644 index 0000000..20c0897 --- /dev/null +++ b/src/test/org/codehaus/groovy/runtime/EncodingGroovyMethodsTest.java @@ -0,0 +1,36 @@ +/* + * 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 org.codehaus.groovy.runtime; + +import org.junit.Assert; +import org.junit.Test; + +public class EncodingGroovyMethodsTest { + @Test + public void md5() throws Exception { + Assert.assertEquals("e99a18c428cb38d5f260853678922e03", EncodingGroovyMethods.md5("abc123")); + Assert.assertEquals("e99a18c428cb38d5f260853678922e03", EncodingGroovyMethods.md5("abc123".getBytes("UTF-8"))); + } + + @Test + public void digest() throws Exception { + Assert.assertEquals("e99a18c428cb38d5f260853678922e03", EncodingGroovyMethods.digest("abc123", "MD5")); + Assert.assertEquals("e99a18c428cb38d5f260853678922e03", EncodingGroovyMethods.digest("abc123".getBytes("UTF-8"), "MD5")); + } +}
