Package com.irurueta.geometry.io
Class MaterialLoaderTest
java.lang.Object
com.irurueta.geometry.io.MaterialLoaderTest
Tests the shared behaviour of
MaterialLoader using MaterialLoaderOBJ as the concrete implementation.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidChecks that closing releases the reader and that closing twice is harmless.(package private) voidChecks that a file reaching the limit is read through a regular file reader.(package private) voidChecks that a file and listener constructor uses a regular file reader for large files.(package private) voidChecks that a file smaller than the limit is read through a memory mapped reader.private FilecreateLargeFile(String name) Creates a (sparse) file whose size reaches the limit to keep files in memory.private FilecreateSmallFile(String name) Creates a small file in the temporary folder.(package private) voidChecks that setting a file or a listener while locked throws.(package private) voidChecks that setting a file replaces and closes any previous reader, and that the limit selects the reader type.(package private) voidChecks that changing the file size limit while unlocked is stored and that it is rejected while locked.
-
Field Details
-
LARGE_FILE_SIZE
private static final long LARGE_FILE_SIZESize in bytes of files that must not be kept in memory.- See Also:
-
CONTENT
Content written into small temporary files.- See Also:
-
tempDir
Temporary folder where generated files are stored.
-
-
Constructor Details
-
MaterialLoaderTest
MaterialLoaderTest()
-
-
Method Details
-
constructor_whenSmallFile_usesMappedReader
Checks that a file smaller than the limit is read through a memory mapped reader.- Throws:
IOException- if an I/O error occurs.
-
constructor_whenLargeFile_usesFileReader
Checks that a file reaching the limit is read through a regular file reader.- Throws:
IOException- if an I/O error occurs.
-
constructor_whenLargeFileAndListener_usesFileReader
Checks that a file and listener constructor uses a regular file reader for large files.- Throws:
IOException- if an I/O error occurs.
-
setFileSizeLimitToKeepInMemory_whenLocked_throwsLockedException
@Test void setFileSizeLimitToKeepInMemory_whenLocked_throwsLockedException() throws IOException, LockedExceptionChecks that changing the file size limit while unlocked is stored and that it is rejected while locked.- Throws:
IOException- if an I/O error occurs.LockedException- if the loader is unexpectedly locked.
-
setFile_whenPreviousFileAndLimitChanges_replacesReader
@Test void setFile_whenPreviousFileAndLimitChanges_replacesReader() throws IOException, LockedExceptionChecks that setting a file replaces and closes any previous reader, and that the limit selects the reader type.- Throws:
IOException- if an I/O error occurs.LockedException- if the loader is unexpectedly locked.
-
setFile_whenLocked_throwsLockedException
Checks that setting a file or a listener while locked throws.- Throws:
IOException- if an I/O error occurs.
-
close_whenCalledTwice_releasesReaderOnce
Checks that closing releases the reader and that closing twice is harmless.- Throws:
IOException- if an I/O error occurs.
-
createSmallFile
Creates a small file in the temporary folder.- Parameters:
name- name of the file.- Returns:
- created file.
- Throws:
IOException- if an I/O error occurs.
-
createLargeFile
Creates a (sparse) file whose size reaches the limit to keep files in memory.- Parameters:
name- name of the file.- Returns:
- created file.
- Throws:
IOException- if an I/O error occurs.
-