Move back to JUnit 4 until SUREFIRE-1614 has been resolved
See gh-14736 See gh-14737 See gh-14738
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,14 +20,18 @@ import java.io.File;
|
||||
|
||||
import org.cassandraunit.spring.CassandraDataSet;
|
||||
import org.cassandraunit.spring.EmbeddedCassandra;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.extension.OutputCapture;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.TestExecutionListeners.MergeMode;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -36,20 +40,43 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@TestExecutionListeners(mergeMode = MergeMode.MERGE_WITH_DEFAULTS, listeners = {
|
||||
OrderedCassandraTestExecutionListener.class })
|
||||
@ExtendWith(OutputCapture.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@CassandraDataSet(keyspace = "mykeyspace", value = "setup.cql")
|
||||
@EmbeddedCassandra(timeout = 60000)
|
||||
public class SampleCassandraApplicationTests {
|
||||
|
||||
@ClassRule
|
||||
public static final SkipOnWindows skipOnWindows = new SkipOnWindows();
|
||||
|
||||
@ClassRule
|
||||
public static final OutputCapture output = new OutputCapture();
|
||||
|
||||
@Test
|
||||
public void testDefaultSettings(OutputCapture output) {
|
||||
Assumptions.assumeFalse(this::runningOnWindows);
|
||||
assertThat(output).contains("firstName='Alice', lastName='Smith'");
|
||||
public void testDefaultSettings() {
|
||||
assertThat(output.toString()).contains("firstName='Alice', lastName='Smith'");
|
||||
}
|
||||
|
||||
private boolean runningOnWindows() {
|
||||
return File.separatorChar == '\\';
|
||||
static class SkipOnWindows implements TestRule {
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
return new Statement() {
|
||||
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
if (!runningOnWindows()) {
|
||||
base.evaluate();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean runningOnWindows() {
|
||||
return File.separatorChar == '\\';
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user