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.
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package sample.aop;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.test.extension.OutputCapture;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -33,17 +33,17 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
public class SampleAopApplicationTests {
|
||||
|
||||
@RegisterExtension
|
||||
OutputCapture output = new OutputCapture();
|
||||
@Rule
|
||||
public final OutputCapture output = new OutputCapture();
|
||||
|
||||
private String profiles;
|
||||
|
||||
@BeforeEach
|
||||
@Before
|
||||
public void init() {
|
||||
this.profiles = System.getProperty("spring.profiles.active");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
@After
|
||||
public void after() {
|
||||
if (this.profiles != null) {
|
||||
System.setProperty("spring.profiles.active", this.profiles);
|
||||
@@ -56,13 +56,13 @@ public class SampleAopApplicationTests {
|
||||
@Test
|
||||
public void testDefaultSettings() throws Exception {
|
||||
SampleAopApplication.main(new String[0]);
|
||||
assertThat(this.output).contains("Hello Phil");
|
||||
assertThat(this.output.toString()).contains("Hello Phil");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCommandLineOverrides() throws Exception {
|
||||
SampleAopApplication.main(new String[] { "--name=Gordon" });
|
||||
assertThat(this.output).contains("Hello Gordon");
|
||||
assertThat(this.output.toString()).contains("Hello Gordon");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user