hequn8128 commented on a change in pull request #7370: [FLINK-11161]Unable to
import java packages in scala-shell
URL: https://github.com/apache/flink/pull/7370#discussion_r244248189
##########
File path:
flink-scala-shell/src/test/scala/org/apache/flink/api/scala/ScalaShellITCase.scala
##########
@@ -362,6 +362,83 @@ class ScalaShellITCase extends TestLogger {
Assert.assertFalse(output.contains("ERROR"))
Assert.assertFalse(output.contains("Exception"))
}
+
+ @Test
+ def testImportJavaCollection(): Unit = {
+ val input = """
+ import java.util.List
+ val jul: List[Int] = new java.util.ArrayList[Int]()
+ jul.add(2)
+ jul.add(4)
+ jul.add(6)
+ jul.add(8)
+ jul.add(10)
+ val str = "the java list size is: " + jul.size
+ """.stripMargin
+
+ val output = processInShell(input)
+
+ Assert.assertTrue(output.contains("the java list size is: 5"))
+ Assert.assertFalse(output.contains("failed"))
Review comment:
Ignore case when comparing for these assertFalse so that more abnormal cases
can be checked. For example, you can call `toLowerCase`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services