Skip to content

Commit

Permalink
tests: Convert String to TextBlock
Browse files Browse the repository at this point in the history
automated Cleanup
  • Loading branch information
EcljpseB0T authored and jukzi committed May 17, 2024
1 parent 146659c commit 4a5ece5
Show file tree
Hide file tree
Showing 182 changed files with 120,051 additions and 114,334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,22 @@ public abstract class AbstractForLoopJavaContextTest {

private static final String CU_NAME= "A.java";

private static final String CU_PREFIX= "package test;\n" +
"\n" +
"import java.io.Serializable;\n" +
"import java.util.Collection;\n" +
"import java.util.List;\n" +
"\n" +
"public class A<E extends Number> {\n";

private static final String CU_POSTFIX= " {\n" +
" \n" +
"}\n" +
"}\n";
private static final String CU_PREFIX= """
package test;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
public class A<E extends Number> {
""";

private static final String CU_POSTFIX= """
{
\t
}
}
""";

private IJavaProject fProject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,80 +40,96 @@ protected Template getForLoop() {
public void simpleArray() throws Exception {
String template= evaluateTemplateInMethod("void method(Number[] numbers)");
assertEquals(
" for (int i = 0; i < numbers.length; i++) {\n" +
" Number number = numbers[i];\n" +
" \n" +
" }", template);
"""
for (int i = 0; i < numbers.length; i++) {
Number number = numbers[i];
\t
}\
""", template);
}

@Test
public void innerClassArray() throws Exception {
String template= evaluateTemplateInMethod("void method(Inner[] inners)");
assertEquals(
" for (int i = 0; i < inners.length; i++) {\n" +
" Inner inner = inners[i];\n" +
" \n" +
" }", template);
"""
for (int i = 0; i < inners.length; i++) {
Inner inner = inners[i];
\t
}\
""", template);
}

@Test
public void innerClassParameterized() throws Exception {
String template= evaluateTemplateInMethod("void method(Inner2<Number>[] inners)");
assertEquals(
" for (int i = 0; i < inners.length; i++) {\n" +
" Inner2<Number> inner2 = inners[i];\n" +
" \n" +
" }", template);
"""
for (int i = 0; i < inners.length; i++) {
Inner2<Number> inner2 = inners[i];
\t
}\
""", template);
}

@Test
public void generic() throws Exception {
String template= evaluateTemplateInMethod("void <T> method(T[] generics)");
assertEquals(
" for (int i = 0; i < generics.length; i++) {\n" +
" T t = generics[i];\n" +
" \n" +
" }", template);
"""
for (int i = 0; i < generics.length; i++) {
T t = generics[i];
\t
}\
""", template);
}

@Test
public void uppderboundGeneric() throws Exception {
String template= evaluateTemplateInMethod("void <T extends Number> method(T[] numbers)");
assertEquals(
" for (int i = 0; i < numbers.length; i++) {\n" +
" T t = numbers[i];\n" +
" \n" +
" }", template);
"""
for (int i = 0; i < numbers.length; i++) {
T t = numbers[i];
\t
}\
""", template);
}

@Test
public void lowerboundGeneric() throws Exception {
String template= evaluateTemplateInMethod("void <T super Number> method(T[] objects)");
assertEquals(
" for (int i = 0; i < objects.length; i++) {\n" +
" T t = objects[i];\n" +
" \n" +
" }", template);
"""
for (int i = 0; i < objects.length; i++) {
T t = objects[i];
\t
}\
""", template);
}

@Test
public void proposalsWithField() throws Exception {
String template= evaluateTemplateInMethodWithField("void method()", "Number[] numbers");
assertEquals(
" for (int i = 0; i < numbers.length; i++) {\n" +
" Number number = numbers[i];\n" +
" \n" +
" }", template);
"""
for (int i = 0; i < numbers.length; i++) {
Number number = numbers[i];
\t
}\
""", template);
}

@Test
public void proposalsWithFieldAndParam() throws Exception {
String template= evaluateTemplateInMethodWithField("void method(String[] strings)", "Number[] numbers");
assertEquals(
" for (int i = 0; i < strings.length; i++) {\n" +
" String string = strings[i];\n" +
" \n" +
" }", template);
"""
for (int i = 0; i < strings.length; i++) {
String string = strings[i];
\t
}\
""", template);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,26 @@ public class BracketInserterTest {
private static final String SRC= "src";
private static final String SEP= "/";
private static final String CU_NAME= "PR75423.java";
private static final String CU_CONTENTS= "package com.example.bugs;\n" +
"\n" +
"import java.lang.String;\n" +
"import java.lang.Integer;\n" +
"\n" +
"public class PR75423 {\n" +
" String string;\n" +
" Integer integer;\n" +
"\n" +
" public static void main(String[] args) {\n" +
" \n" +
" }\n" +
" void foo(String[] args) {\n" +
" \n" +
" }\n" +
" \n" +
" HashMap hm= new HashMap();\n" +
"}\n";
private static final String CU_CONTENTS= """
package com.example.bugs;
import java.lang.String;
import java.lang.Integer;
public class PR75423 {
String string;
Integer integer;
public static void main(String[] args) {
\s
}
void foo(String[] args) {
\s
}
\s
HashMap hm= new HashMap();
}
""";

// document offsets
private static final int BODY_OFFSET= 196;
Expand Down

0 comments on commit 4a5ece5

Please sign in to comment.