remove test case of the old approche

This commit is contained in:
Till Schnell 2021-04-08 11:30:49 +02:00
parent 0cdeee9e0d
commit e5d5376ce9

View File

@ -1,69 +0,0 @@
package inferWildcards;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
import org.junit.Before;
import org.junit.Test;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.Tree;
import com.sun.source.util.JavacTask;
import de.dhbwstuttgart.inferWildcards.InferWildcardsVisitor;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
public class TestInferWildcards
{
private JavaCompiler compiler;
private StandardJavaFileManager fileManager;
@Before
public void setup () {
compiler = ToolProvider.getSystemJavaCompiler();
fileManager = compiler.getStandardFileManager(null, null, null);
}
private Iterable<? extends CompilationUnitTree> parse (File[] files) throws IOException {
Iterable<? extends JavaFileObject> compilationUnits1 = fileManager
.getJavaFileObjectsFromFiles(Arrays.asList(files));
JavacTask task = (JavacTask) compiler.getTask(null, fileManager, null, null, null, compilationUnits1);
return task.parse();
}
@Test
public void test () throws Exception {
String resourcePath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards";
File[] files1 = { new File(resourcePath + "/TestClassWildcards.java") };
Iterable<? extends CompilationUnitTree> iterable = parse(files1);
for (CompilationUnitTree t : iterable) {
System.out.println("unit: " + t.toString());
testUnit(t);
}
}
@SuppressWarnings("rawtypes")
private void testUnit (CompilationUnitTree t) {
InferWildcardsVisitor inferWildcardsVisitor = new InferWildcardsVisitor();
t.accept(inferWildcardsVisitor, null);
// Generated Constraints
ConstraintSet constraintSet = inferWildcardsVisitor.getConstraintSet();
System.out.println("Constraints: " + constraintSet);
// Generated TPH
Map<TypePlaceholder, Tree> placeholderMapping = inferWildcardsVisitor.getPlaceholderMapping();
System.out.println("Placeholder: " + placeholderMapping.toString());
}
}