Skip to content

Commit

Permalink
Support rules of type ExternalResource
Browse files Browse the repository at this point in the history
add tests for the initial rule support.

#433
  • Loading branch information
Matthias Merdes authored and Matthias Merdes committed Sep 28, 2016
1 parent d9cfac6 commit cc25056
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.junit.jupiter.engine.vintage.rulesupport;

import java.io.File;
import java.io.IOException;

import org.junit.Rule;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.rules.TemporaryFolder;

@ExtendWith(ExternalResourceLegacySupport.class)
public class ExternalResourceLegacySupportTests {

private File file;

@Rule
public TemporaryFolder folder = new TemporaryFolder();

@BeforeEach
void setup() throws IOException {
this.file = folder.newFile("temp.txt");
}

@Test
void checkTemporaryFolder() {
System.out.println("file of TemporaryFolder: " + this.file);
assert file.canRead();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.junit.jupiter.engine.vintage.rulesupport;

import org.junit.Rule;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.rules.TemporaryFolder;

public class ExternalResourceWithoutAdapterTests {

@Rule
public TemporaryFolder folder = new TemporaryFolder();

@BeforeEach
void setup() {
try {
folder.newFile("temp.txt");
}
catch (Exception exception) {
System.out.println("exception = " + exception.getMessage());
assert exception.getMessage().equals("the temporary folder has not yet been created");
}
}

@Test
void checkTemporaryFolder() {
// only needed to invoke testing at all
}

}

0 comments on commit cc25056

Please sign in to comment.