Got an issue when exception thrown by test is ignored by sbt and does not break the build.
Some code:
Test:
@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
}
}
If i remove SpringJUnit4ClassRunner and inject dependency myself it will break the build as expected.
If i forbid sbt to fork test process it will also break the build:
lazy val myProject = project.in(file("foo/proj"))
.settings(....)
.settings(sbt.Keys.fork in Test := false) <- the exception breaks the build
Any idea why it happens?
Thanx in advance
Looks like it was an issue of SBT. once i updated it from 0.13.5 to 0.13.8 the problem was gone.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.