- * So this test class uses a {@link RestartableJenkinsRule} to check the behaviour of this sysprop being
+ * So this test class uses a {@link JenkinsSessionExtension} to check the behaviour of this sysprop being
* present or not between two restarts.
*/
-public class JenkinsBuildsAndWorkspacesDirectoriesTest {
+class JenkinsBuildsAndWorkspacesDirectoriesTest {
private static final String LOG_WHEN_CHANGING_BUILDS_DIR = "Changing builds directories from ";
private static final String LOG_WHEN_CHANGING_WORKSPACES_DIR = "Changing workspaces directories from ";
- @Rule
- public RestartableJenkinsRule story = new RestartableJenkinsRule();
+ @RegisterExtension
+ private final JenkinsSessionExtension story = new JenkinsSessionExtension();
- @Rule
- public LoggerRule loggerRule = new LoggerRule();
+ private final LogRecorder loggerRule = new LogRecorder();
- @ClassRule
- public static TemporaryFolder tmp = new TemporaryFolder();
+ @TempDir
+ private static File tmp;
- @Before
- public void before() {
+ @BeforeEach
+ void before() {
clearSystemProperties();
}
- @After
- public void after() {
+ @AfterEach
+ void after() {
clearSystemProperties();
}
@@ -72,7 +73,7 @@ private void clearSystemProperties() {
@Issue("JENKINS-53284")
@Test
- public void changeWorkspacesDirLog() throws Exception {
+ void changeWorkspacesDirLog() throws Throwable {
loggerRule.record(Jenkins.class, Level.WARNING)
.record(Jenkins.class, Level.INFO).capture(1000);
@@ -92,7 +93,7 @@ public void changeWorkspacesDirLog() throws Exception {
@Issue("JENKINS-50164")
@Test
- public void badValueForBuildsDir() {
+ void badValueForBuildsDir() throws Throwable {
story.then(rule -> {
final List