Package de.freaklamarsch.systarest.tests
Class DataLoggerTest
java.lang.Object
de.freaklamarsch.systarest.tests.DataLoggerTest
public class DataLoggerTest
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.Integer[]
dataArray
private static java.time.format.DateTimeFormatter
DEFAULT_FORMATTER
(package private) DataLogger<java.lang.Integer>
logger
(package private) java.nio.file.Path
logPath
(package private) java.nio.file.Path
tempDir
-
Constructor Summary
Constructors Constructor Description DataLoggerTest()
-
Method Summary
Modifier and Type Method Description (package private) void
setUp()
void
testConstructor()
(package private) void
testLogEntryDelimiterEdgeCases()
(package private) void
testMultipleFileWritesAndBuffering()
(package private) void
testNoFileWrittenWhenLoggingIsOff()
(package private) void
testReactivatingLoggingFlushesExistingBuffer()
(package private) void
testSingleFileWriteOnCapacityOne()
(package private) void
testStopSavingFlushesBuffer()
(package private) void
testTimestampLogic()
(package private) void
testWriteOnEmptyBufferNoFileGenerated()
private void
verifyFileContent(java.nio.file.Path filePath, java.lang.String expectedDelimiter, java.util.List<java.util.Map.Entry<java.lang.Long,java.lang.Integer[]>> expectedEntriesInChronologicalOrder, int expectedArrayLength)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
tempDir
@TempDir java.nio.file.Path tempDir -
logger
DataLogger<java.lang.Integer> logger -
dataArray
java.lang.Integer[] dataArray -
logPath
java.nio.file.Path logPath -
DEFAULT_FORMATTER
private static final java.time.format.DateTimeFormatter DEFAULT_FORMATTER
-
-
Constructor Details
-
DataLoggerTest
public DataLoggerTest()
-
-
Method Details
-
setUp
@BeforeEach void setUp() throws java.io.IOException- Throws:
java.io.IOException
-
testConstructor
@Test public void testConstructor() -
testSingleFileWriteOnCapacityOne
@Test void testSingleFileWriteOnCapacityOne() throws java.io.IOException- Throws:
java.io.IOException
-
testMultipleFileWritesAndBuffering
@Test void testMultipleFileWritesAndBuffering() throws java.io.IOException- Throws:
java.io.IOException
-
testStopSavingFlushesBuffer
@Test void testStopSavingFlushesBuffer() throws java.io.IOException- Throws:
java.io.IOException
-
testNoFileWrittenWhenLoggingIsOff
@Test void testNoFileWrittenWhenLoggingIsOff() throws java.io.IOException- Throws:
java.io.IOException
-
testReactivatingLoggingFlushesExistingBuffer
@Test void testReactivatingLoggingFlushesExistingBuffer() throws java.io.IOException- Throws:
java.io.IOException
-
verifyFileContent
private void verifyFileContent(java.nio.file.Path filePath, java.lang.String expectedDelimiter, java.util.List<java.util.Map.Entry<java.lang.Long,java.lang.Integer[]>> expectedEntriesInChronologicalOrder, int expectedArrayLength) throws java.io.IOException- Throws:
java.io.IOException
-
testLogEntryDelimiterEdgeCases
@Test void testLogEntryDelimiterEdgeCases() throws java.io.IOException- Throws:
java.io.IOException
-
testTimestampLogic
@Test void testTimestampLogic() throws java.io.IOException- Throws:
java.io.IOException
-
testWriteOnEmptyBufferNoFileGenerated
@Test void testWriteOnEmptyBufferNoFileGenerated() throws java.io.IOException- Throws:
java.io.IOException
-