Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Consider this small but innocuous piece of code

Code Block
languagec#java
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
languagejava
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
   }
}

...