public class ApprobationContext
extends java.lang.Object
Wrapper around the approved and received files.
The files are specified by a parent folder and a method name.
| Constructor and Description |
|---|
ApprobationContext(java.nio.file.Path folder,
java.lang.String methodName) |
| Modifier and Type | Method and Description |
|---|---|
java.nio.file.Path |
approvedFile(java.nio.file.Path relativeFile) |
void |
createEmptyApprovedFileIfEmpty() |
java.lang.String |
readApproved()
Reads the content of the approved file linked to the current method execution.
|
java.lang.String |
readApproved(java.nio.file.Path relativeFile)
Reads from a file relative to the approved folder.
|
java.lang.String |
readReceived()
Reads the content of the received file linked to the current method execution.
|
java.nio.file.Path |
receivedFile(java.nio.file.Path relativeFile) |
void |
removeApproved()
Removes the approved file linked to the current method execution.
|
void |
removeApproved(java.nio.file.Path relativeFile) |
void |
removeReceived()
Removes the received file linked to the current method execution.
|
void |
removeReceived(java.nio.file.Path relativeFile) |
void |
writeApproved(java.lang.String content)
Writes the provided content in the approved file linked to the current method execution.
|
void |
writeApproved(java.lang.String content,
java.nio.file.Path relativeFile)
Writes content to a file relative to the approved folder.
|
void |
writeReceived(java.lang.String content)
Writes the provided content in the received file linked to the current method execution.
|
void |
writeReceived(java.lang.String content,
java.nio.file.Path relativeFile) |
public ApprobationContext(java.nio.file.Path folder,
java.lang.String methodName)
public void writeApproved(java.lang.String content)
Writes the provided content in the approved file linked to the current method execution.
That method will actually retrieve the method from which the call has been made and name the approved file from the testClass attribute, but also the parent method calling this one.
If the file doesn’t exist, that method will create it in the src/test/resources folder.
content - Content to be written in the approved file linked to the parent method execution.public void writeApproved(java.lang.String content,
java.nio.file.Path relativeFile)
Writes content to a file relative to the approved folder.
public void writeReceived(java.lang.String content,
java.nio.file.Path relativeFile)
public java.lang.String readApproved(java.nio.file.Path relativeFile)
Reads from a file relative to the approved folder.
public void removeApproved(java.nio.file.Path relativeFile)
public void removeReceived(java.nio.file.Path relativeFile)
public java.nio.file.Path approvedFile(java.nio.file.Path relativeFile)
public java.nio.file.Path receivedFile(java.nio.file.Path relativeFile)
public java.lang.String readApproved()
Reads the content of the approved file linked to the current method execution.
That method will actually retrieve the method from which the call has been made and read the approved file linked to the testClass attribute and the parent method calling this one.
If the file doesn’t exist, that method will simply display a message in System.err but won’t fail.
public void removeApproved()
Removes the approved file linked to the current method execution.
That method will actually retrieve the method from which the call has been made and find the approved file linked to the testClass attribute and the parent method calling this one.
If the file doesn’t exist, it won’t do anything and won’t return any kind of error.
public void writeReceived(java.lang.String content)
Writes the provided content in the received file linked to the current method execution.
That method will actually retrieve the method from which the call has been made and name the received file from the testClass attribute, but also the parent method calling this one.
If the file doesn’t exist, that method will create it in the src/test/resources folder.
content - Content to be written in the received file linked to the parent method execution.public java.lang.String readReceived()
Reads the content of the received file linked to the current method execution.
That method will actually retrieve the method from which the call has been made and read the received file linked to the testClass attribute and the parent method calling this one.
If the file doesn’t exist, that method will simply display a message in System.err but won’t fail.
public void removeReceived()
Removes the received file linked to the current method execution.
That method will actually retrieve the method from which the call has been made and find the received file linked to the testClass attribute and the parent method calling this one.
If the file doesn’t exist, it won’t do anything and won’t return any kind of error.
public void createEmptyApprovedFileIfEmpty()
Copyright © 2018 Write Them First!. All rights reserved.