Package net.masterthought.cucumber.util
Class Util
- java.lang.Object
-
- net.masterthought.cucumber.util.Util
-
public final class Util extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static Util
INSTANCE
static NumberFormat
PERCENT_FORMATTER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Hook>
eliminateEmptyHooks(Hook[] hooks)
Helper method that removes empty hooks from passed array and packs it into new collection.static String
formatAsDecimal(int value, int total)
static String
formatAsPercentage(int value, int total)
Returns value converted to percentage format.static String
formatDuration(long duration)
static String
toValidFileName(String fileName)
Converts characters of passed string and replaces to hash which can be treated as valid file name.
-
-
-
Field Detail
-
PERCENT_FORMATTER
public static final NumberFormat PERCENT_FORMATTER
-
INSTANCE
public static final Util INSTANCE
-
-
Method Detail
-
formatDuration
public static String formatDuration(long duration)
-
formatAsPercentage
public static String formatAsPercentage(int value, int total)
Returns value converted to percentage format.- Parameters:
value
- value to converttotal
- sum of all values- Returns:
- converted values including '%' character
-
formatAsDecimal
public static String formatAsDecimal(int value, int total)
-
toValidFileName
public static String toValidFileName(String fileName)
Converts characters of passed string and replaces to hash which can be treated as valid file name.- Parameters:
fileName
- sequence that should be converted- Returns:
- converted string
-
-