...
Code Block | ||
---|---|---|
| ||
package com.celestial.files; import java.time.LocalTime; public class DataClerk { public class FileLog { public void ClearTheLog() { // Simulated method that would do something to files in the log } } private FileLog theFileLog; public void ProcessData() { LocalTime now = LocalTime.now(); LocalTime stopTime = LocalTime.parse("20:00"); if( now.isBefore(stopTime) ) { System.out.println("Ready to process the data"); FileLog fl = new FileLog(); fl.ClearTheLog(); } } } |
And here is the initial test
Code Block |
---|
package com.celestial.files;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class DataClerkTest
{
@Test
public void testProcessData()
{
// arrange
DataClerk cut = new DataClerk();
// act
cut.ProcessData();
// assert
// There is no way of knowing if this ran as expected
}
} |
There are a number of things that should cause the alarm bells to ring
...