Top Description Inners Constructors Methods
org.testng.util

public final Class TimeUtils

extends Object
Class Inheritance
Imports
java.text.SimpleDateFormat, java.time.Duration, .Instant, java.util.TimeZone, org.testng.internal.RuntimeBehavior, .Utils

A Utility class that deals with time.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
TimeUtils.Task

A sample task to be executed.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
computeAndShowTime(String
- A user friendly message to be shown in the logs.
msg
,
TimeUtils.Task
- A Task that represents the task to be executed.
task
)

Helper method that can be used to compute the time.

public static String

Returns:

- A formatted string representation of the time in the timezone as obtained via RuntimeBehavior#getTimeZone()
formatTimeInLocalOrSpecifiedTimeZone
(long
- The time in milliseconds
timeInMilliSeconds
,
String
- A format that can be used by SimpleDateFormat
format
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TimeUtilsback to summary
private TimeUtils()

Method Detail

computeAndShowTimeback to summary
public static void computeAndShowTime(String msg, TimeUtils.Task task)

Helper method that can be used to compute the time.

Parameters
msg:String

- A user friendly message to be shown in the logs.

task:TimeUtils.Task

- A Task that represents the task to be executed.

formatTimeInLocalOrSpecifiedTimeZoneback to summary
public static String formatTimeInLocalOrSpecifiedTimeZone(long timeInMilliSeconds, String format)
Parameters
timeInMilliSeconds:long

- The time in milliseconds

format:String

- A format that can be used by SimpleDateFormat

Returns:String

- A formatted string representation of the time in the timezone as obtained via RuntimeBehavior#getTimeZone()

org.testng.util back to summary

public Interface TimeUtils.Task

Annotations
@FunctionalInterface

A sample task to be executed.

Method Summary

Modifier and TypeMethod and Description
public void
execute()

The actual work to be executed.

Method Detail

executeback to summary
public void execute()

The actual work to be executed.