Skip to content

Commit

Permalink
Cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
scordio committed Jul 16, 2023
1 parent b878c90 commit deb5417
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1330,18 +1330,18 @@ private static String getName(AnnotatedElement element) {

static class FactoryWithCustomMetaAnnotationTestCase {

@CustomTempDir("field")
@TempDirWithPrefix("field")
private Path tempDir1;

private Path tempDir2;

@BeforeEach
void beforeEach(@CustomTempDir("beforeEach") Path tempDir2) {
void beforeEach(@TempDirWithPrefix("beforeEach") Path tempDir2) {
this.tempDir2 = tempDir2;
}

@Test
void test(@CustomTempDir("method") Path tempDir3) {
void test(@TempDirWithPrefix("method") Path tempDir3) {
assertThat(tempDir1.getFileName()).asString().startsWith("field");
assertThat(tempDir2.getFileName()).asString().startsWith("beforeEach");
assertThat(tempDir3.getFileName()).asString().startsWith("method");
Expand All @@ -1350,7 +1350,7 @@ void test(@CustomTempDir("method") Path tempDir3) {
@Target({ ANNOTATION_TYPE, FIELD, PARAMETER })
@Retention(RUNTIME)
@TempDir(factory = FactoryWithCustomMetaAnnotationTestCase.Factory.class)
private @interface CustomTempDir {
private @interface TempDirWithPrefix {

String value();

Expand All @@ -1361,8 +1361,8 @@ private static class Factory implements TempDirFactory {
@Override
public Path createTempDirectory(AnnotatedElementContext elementContext, ExtensionContext extensionContext)
throws Exception {
String prefix = elementContext.findAnnotation(CustomTempDir.class).map(
CustomTempDir::value).orElseThrow();
String prefix = elementContext.findAnnotation(TempDirWithPrefix.class) //
.map(TempDirWithPrefix::value).orElseThrow();
return Files.createTempDirectory(prefix);
}

Expand Down

0 comments on commit deb5417

Please sign in to comment.