我有一个问题,在我的Mac上用山狮和java 7开始玩2.2.0应用程序:
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:159)
at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:85)
at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:79)
at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala)
at sbt.GlobalLogging$.initial(GlobalLogging.scala:40)
at sbt.StandardMain$.initialGlobalLogging(Main.scala:54)
at sbt.StandardMain$.initialState(Main.scala:60)
at sbt.xMain.run(Main.scala:26)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
java.lang.IncompatibleClassChangeError: JLine incompatibility detected. Check that the sbt launcher is version 0.13.x or later.
at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:96)
at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:79)
at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala)
at sbt.GlobalLogging$.initial(GlobalLogging.scala:40)
at sbt.StandardMain$.initialGlobalLogging(Main.scala:54)
at sbt.StandardMain$.initialState(Main.scala:60) …Run Code Online (Sandbox Code Playgroud) 我有一个整数列表(当前),我想检查此列表是否包含预期列表中的所有元素,甚至列表中的一个元素notExpected,因此代码如下所示:
List<Integer> expected= new ArrayList<Integer>();
expected.add(1);
expected.add(2);
List<Integer> notExpected = new ArrayList<Integer>();
notExpected.add(3);
notExpected.add(4);
List<Integer> current = new ArrayList<Integer>();
current.add(1);
current.add(2);
assertThat(current, not(hasItems(notExpected.toArray(new Integer[expected.size()]))));
assertThat(current, (hasItems(expected.toArray(new Integer[expected.size()]))));
Run Code Online (Sandbox Code Playgroud)
好久不过.但是当我补充说
current.add(3);
Run Code Online (Sandbox Code Playgroud)
测试也是绿色的.我滥用了hamcrest匹配器吗?顺便说一句.
for (Integer i : notExpected)
assertThat(current, not(hasItem(i)));
Run Code Online (Sandbox Code Playgroud)
给了我正确的答案,但我认为我可以很容易地使用hamcrest匹配器.我正在使用junit 4.11和hamcrest 1.3