You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by bl...@apache.org on 2023/10/03 18:15:16 UTC
[groovy] 01/01: GROOVY-9801: add test case for stub generation with default method
This is an automated email from the ASF dual-hosted git repository.
blackdrag pushed a commit to branch bugfix/GROOVY-9801/additional_test_case
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 79eae1cac2e9129a9cb097a3a968881f639d0914
Author: Jochen Theodorou <bl...@gmx.org>
AuthorDate: Tue Oct 3 20:14:59 2023 +0200
GROOVY-9801: add test case for stub generation with default method
---
...hDefaultMethodHasDefaultModifierStubTest.groovy | 46 ++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/src/test/org/codehaus/groovy/tools/stubgenerator/InterfaceWithDefaultMethodHasDefaultModifierStubTest.groovy b/src/test/org/codehaus/groovy/tools/stubgenerator/InterfaceWithDefaultMethodHasDefaultModifierStubTest.groovy
new file mode 100644
index 0000000000..f38ce3345a
--- /dev/null
+++ b/src/test/org/codehaus/groovy/tools/stubgenerator/InterfaceWithDefaultMethodHasDefaultModifierStubTest.groovy
@@ -0,0 +1,46 @@
+/*
+ * 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.tools.stubgenerator
+
+class InterfaceWithDefaultMethodHasDefaultModifierStubTest extends StringSourcesStubTestCase {
+ @Override
+ Map<String, String> provideSources() {
+ [
+ 'Dummy.java': '''
+ public class Dummy{}
+ ''',
+
+ 'DefaultInterface.groovy': '''
+ interface DefaultInterface {
+ default String m0() {
+ return "m0"
+ }
+ String m3();
+ }
+ '''
+ ]
+ }
+
+ @Override
+ void verifyStubs() {
+ def stubContent = stubJavaSourceFor('DefaultInterface');
+ assert stubContent.contains('default java.lang.String m0() { return null; }')
+ assert stubContent.contains('java.lang.String m3();')
+ }
+}