Java Code Examples for org.approvaltests.Approvals#createApprovalNamer()
The following examples show how to use
org.approvaltests.Approvals#createApprovalNamer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileApproverTest.java From ApprovalTests.Java with Apache License 2.0 | 5 votes |
@Test public void testCustomApprover() { // begin-snippet: custom_approver ApprovalTextWriter writer = new ApprovalTextWriter("Random: ", "txt"); ApprovalNamer namer = Approvals.createApprovalNamer(); Function2<File, File, Boolean> approveEverything = (r, a) -> true; Approvals.verify(new FileApprover(writer, namer, approveEverything)); // end-snippet }
Example 2
Source File: VelocityApprovals.java From ApprovalTests.Java with Apache License 2.0 | 5 votes |
public static void verify(ContextAware context, String fileExtentsionWithDot) { ApprovalNamer namer = Approvals.createApprovalNamer(); String file = namer.getSourceFilePath() + namer.getApprovalName() + ".template" + fileExtentsionWithDot; FileUtils.createIfNeeded(file); String text = VelocityParser.parseFile(file, context); Approvals.verify(text, fileExtentsionWithDot.substring(1)); }
Example 3
Source File: StackTraceNamerUtils.java From ApprovalTests.Java with Apache License 2.0 | 5 votes |
public static void assertParameterizedTest(String className, String methodName, String input) { try (NamedEnvironment en = NamerFactory.asMachineSpecificTest(input)) { ApprovalNamer name = Approvals.createApprovalNamer(); org.testng.Assert.assertEquals(className + "." + methodName + "." + input, name.getApprovalName()); } }
Example 4
Source File: FileUtilsTest.java From ApprovalTests.Java with Apache License 2.0 | 4 votes |
private String adjacentFile(String name) { ApprovalNamer namer = Approvals.createApprovalNamer(); String file = namer.getSourceFilePath() + name; return file; }