From b686093c55f9df84d036ea528170bc5b39d4d14e Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 10 Apr 2024 14:10:37 +0200 Subject: [PATCH] [Groovy] convert StringValueTest to Java (IDEA-327339) GitOrigin-RevId: 535a2f251dcfa2df2b58ee44d6c2f96e6f7cd370 --- .../plugins/groovy/lang/StringValueTest.java | 67 ++++++++----------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/StringValueTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/StringValueTest.java index c0f50b4b8669..b39167f6b080 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/StringValueTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/StringValueTest.java @@ -1,66 +1,53 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed 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.jetbrains.plugins.groovy.lang +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package org.jetbrains.plugins.groovy.lang; -import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase -import org.jetbrains.annotations.Nullable -import org.jetbrains.plugins.groovy.lang.psi.GroovyFile -import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral -import org.jetbrains.plugins.groovy.util.TestUtils +import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase; +import junit.framework.TestCase; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral; +import org.jetbrains.plugins.groovy.util.TestUtils; /** * @author Max Medvedev */ -class StringValueTest extends LightJavaCodeInsightFixtureTestCase { +public class StringValueTest extends LightJavaCodeInsightFixtureTestCase { @Override protected String getBasePath() { - "${TestUtils.testDataPath}stringValues/" + return TestUtils.getTestDataPath() + "stringValues/"; } private void doTest(@Nullable String expected) { - def file = myFixture.configureByFile("${getTestName(false)}.groovy") as GroovyFile - def literal = file.statements[0] as GrLiteral - assertEquals expected, literal.value + GroovyFile file = (GroovyFile)myFixture.configureByFile(getTestName(false) + ".groovy"); + GrLiteral literal = (GrLiteral)file.getStatements()[0]; + TestCase.assertEquals(expected, literal.getValue()); } - void testString0() { - doTest("fo\nabc \r \u1234 \" \' \" ") + public void testString0() { + doTest("fo\nabc \r ሴ \" ' \" "); } - void testString1() { - doTest(null) + public void testString1() { + doTest(null); } - void testString2() { - doTest(null) + public void testString2() { + doTest(null); } - void testString3() { - doTest("fooabc") + public void testString3() { + doTest("fooabc"); } - void testGString() { - doTest("abc \' \" ") + public void testGString() { + doTest("abc ' \" "); } - void testSlashString() { - doTest("abc \\a \\n / abc \u1234 \$ \\\$ ") + public void testSlashString() { + doTest("abc \\a \\n / abc ሴ $ \\$ "); } - void _testDollarSlashString() { - doTest("/abc \\n \\o \u1234 abc \$ / \\\$ /") + public void _testDollarSlashString() { + doTest("/abc \\n \\o ሴ abc $ / \\$ /"); } }