-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathNamerSamplesTest.java
More file actions
35 lines (32 loc) · 1017 Bytes
/
NamerSamplesTest.java
File metadata and controls
35 lines (32 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.approvaltests.namer;
import com.spun.util.ClassUtils;
import com.spun.util.tests.TestUtils;
import com.spun.util.tests.TestUtils.SourceDirectoryRestorer;
import org.approvaltests.Approvals;
import org.junit.jupiter.api.Test;
import org.lambda.functions.Function2;
import java.io.File;
public class NamerSamplesTest
{
@Test
void useAlternativeSourceFileFinder()
{
// begin-snippet: define_alternative_source_directory_finder
Function2<Class, String, File> myFinder = new Function2<Class, String, File>()
{
@Override
public File call(Class clazz, String fileName)
{
return new File(ClassUtils.getProjectRootPath() + "/src/test/java/"
+ clazz.getPackage().getName().replaceAll("\\.", "/"));
}
};
// end-snippet
// begin-snippet: configure_alternative_source_directory
try (SourceDirectoryRestorer sdr = TestUtils.registerSourceDirectoryFinder(myFinder))
{
Approvals.verify("Ragunath");
}
// end-snippet
}
}