java tests cleanup work
This commit is contained in:
parent
1020ce2389
commit
1c5796c83c
|
@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory;
|
|||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
public class CoreJavaIoIntegrationTest {
|
||||
public class JavaIoIntegrationTest {
|
||||
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
// tests - iterate lines in a file
|
|
@ -7,7 +7,7 @@ import org.apache.commons.lang3.RandomStringUtils;
|
|||
import org.apache.commons.math3.random.RandomDataGenerator;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CoreJavaRandomUnitTest {
|
||||
public class JavaRandomUnitTest {
|
||||
|
||||
// tests - random long
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package org.baeldung.java;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class JavaTimerUnitTest {
|
||||
|
||||
// tests
|
||||
|
||||
@Test
|
||||
public void givenUsingTimer_whenSchedulingTaskOnce_thenCorrect() throws InterruptedException {
|
||||
final TimerTask timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("Task performed on " + new Date() + "\n" + "Thread's name: " + Thread.currentThread().getName());
|
||||
}
|
||||
};
|
||||
|
||||
final Timer timer = new Timer("Timer");
|
||||
final long delay = 1000L;
|
||||
timer.schedule(timerTask, delay);
|
||||
|
||||
Thread.sleep(delay * 2);
|
||||
timer.cancel();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue