Open JuniverseCoder opened 4 years ago
Before you launch your test, do you have any compilation errors? If not then that'd be an issue with vscode-java-test.
vscode-java only supports compiling Java code, so I'd say I'm not surprised. However, looking at your use case, this is something different. Supposedly, your scala dependency is a jar containing compiled class files, so that should work. Could you try to make a simpler sample project reproducing the issue?
@fbricon I try to make a simple project to reproduce the issuse.
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jerry</groupId>
<artifactId>issue-rep</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.12</version>
</dependency>
</dependencies>
</project>
AppTest.java
package com.jerry;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.HashMap;
import java.util.Map;
import scala.Predef;
import scala.Tuple2;
/**
* Unit test for simple App.
*/
public class AppTest {
@Test
public void testApp() {
Map<Integer,Integer> javaMap =new HashMap<Integer,Integer>();
javaMap.put(1, 2);
scala.collection.immutable.Map<Integer, Integer> aMap = scala.collection.JavaConverters
.mapAsScalaMapConverter(javaMap)
.asScala().toMap(Predef.<Tuple2<Integer, Integer>>conforms());
aMap.get(new Integer(1));
}
}
This code is work for maven test, but not work for vscode's compile.
It seems like a bug for ecj. https://bugs.eclipse.org/bugs/show_bug.cgi?id=529336 But I have no idea that which version ecj vscode-java is used.
KafkaAuthBinding.java; line: 360
this code can be compile by idea using com.intellij.junit4.JUnit4IdeaTestRunner, and the test can be successful run with maven.