0
當sbt忽略由測試引發的異常並且不會破壞構建時發生問題。java sbt測試:如果使用SpringJUnit4ClassRunner運行測試,則忽略異常
一些代碼:
測試:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MyConfig.class)
public class MyTest {
@Autowired
private ClassBeingTested sut;
@Test
public void test() {
if (true)
throw new Exception(); //it must break the build, but it doesn't
}
}
如果我刪除基於SpringJUnit4ClassRunner並注入依賴自己這將打破建立符合市場預期。
如果我SBT禁止到餐桌的測試過程中,也將打破建立:
lazy val myProject = project.in(file("foo/proj"))
.settings(....)
.settings(sbt.Keys.fork in Test := false) <- the exception breaks the build
任何想法,爲什麼會發生?
Thanx提前