public class FileOperationsTest extends TestCase
FileOperations
implementations.Constructor and Description |
---|
FileOperationsTest() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertValidTestFile(String testfile)
Checks that a given
String contains exactly the same contents
as the content of getTestFile() . |
org.jdtaus.core.io.FileOperations |
getFileOperations()
Gets the
FileOperations implementation tests are performed with. |
protected InputStream |
getTestFile()
Gets a testfile resource.
|
protected void |
runTest() |
void |
setFileOperations(org.jdtaus.core.io.FileOperations value)
Sets the
FileOperations implementation to test. |
void |
testEndOfFile()
Tests the
FileOperations.read(byte[], int, int) method. |
void |
testGetLength()
Tests the
FileOperations.getLength() method. |
void |
testRead()
Tests the
FileOperations.read(byte[], int, int) method. |
void |
testSetLength()
Tests the
FileOperations.setLength(long) method. |
void |
testSetLengthUpdatesFilePointer()
Tests the
FileOperations.setLength(long) method to correctly
position the file pointer on truncating the file. |
void |
testWrite()
Tests the
FileOperations.write(byte[], int, int) method. |
void |
testWriteBeyondIncreasesLength()
Tests the
FileOperations.write(byte[],int,int) method to
correctly increase the length when writing beyond the current length. |
countTestCases, createResult, getName, run, run, runBare, setName, setUp, tearDown, toString
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
public FileOperationsTest()
public org.jdtaus.core.io.FileOperations getFileOperations()
FileOperations
implementation tests are performed with.FileOperations
implementation tests are performed
with.public final void setFileOperations(org.jdtaus.core.io.FileOperations value)
FileOperations
implementation to test.value
- the FileOperations
implementation to test.protected InputStream getTestFile()
InputStream
for reading the testfile content from.protected void assertValidTestFile(String testfile)
String
contains exactly the same contents
as the content of getTestFile()
.RuntimeException
- if testfile
does not hold the same
characters than the contents of the testfile.getTestFile()
public void testGetLength() throws Exception
FileOperations.getLength()
method.
FileOperations
implementation is 0
.Exception
public void testSetLength() throws Exception
FileOperations.setLength(long)
method.
FileOperations
implementation
to 100L
and checks that the corresponding getLength()
method returns 100L
afterwars.FileOperations
implementation
to 0L
and checks that the corresponding getLength()
method returns 0L
afterwars.IllegalArgumentException
to be thrown.Exception
public void testSetLengthUpdatesFilePointer() throws Exception
FileOperations.setLength(long)
method to correctly
position the file pointer on truncating the file.Exception
public void testWriteBeyondIncreasesLength() throws Exception
FileOperations.write(byte[],int,int)
method to
correctly increase the length when writing beyond the current length.Exception
public void testEndOfFile() throws Exception
FileOperations.read(byte[], int, int)
method.
1
and the filepointer to 1
and
tries to read 1
byte checking for EOF.Exception
public void testRead() throws Exception
FileOperations.read(byte[], int, int)
method.
101
byte from a buffer of 100
byte and checks
that the method returns EOF
for end of file.length
matches the expected value after writing.EOF
for end of file.Exception
public void testWrite() throws Exception
FileOperations.write(byte[], int, int)
method.
length
matches the expected value after writing.length
matches the
expected value after writing.Exception
Copyright © 2005-2012 jDTAUS. All Rights Reserved.