Enum Class InternalUtils
- All Implemented Interfaces:
Serializable
,Comparable<InternalUtils>
,Constable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Deprecated.static final record
Deprecated.static class
Deprecated.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.github.dakusui.actionunit.core.Action
Deprecated.static String
composeResultMessageLine
(Class<?> testClass, String stageName, String line) Deprecated.static <T> Stream
<T> Deprecated.static void
copyTo
(InputStream in1, OutputStream out1) Deprecated.static com.github.dakusui.actionunit.core.Context
Deprecated.Deprecated.currentBranchNameFor
(File projectDir) Deprecated.static Date
Deprecated.Deprecated.static String
dateToSafeString
(Date date) Deprecated.static Stream
<com.github.dakusui.actionunit.core.Action> flattenIfSequential
(com.github.dakusui.actionunit.core.Action a) Deprecated.static Stream
<com.github.dakusui.actionunit.core.Action> flattenSequentialAction
(com.github.dakusui.actionunit.core.Action action) Deprecated.static boolean
Deprecated.static boolean
Deprecated.static boolean
Deprecated.static boolean
isToStringOverridden
(Object object) Deprecated.static String
Deprecated.static void
materializeResource
(File output, String resourcePath) Deprecated.static File
materializeResource
(String resourcePath) Deprecated.static Date
now()
Deprecated.static Consumer
<com.github.dakusui.actionunit.core.Context> printableConsumer
(String consumerName, Consumer<com.github.dakusui.actionunit.core.Context> consumer) Deprecated.static File
Deprecated.static void
removeFile
(File file) Deprecated.static <T> List
<T> Deprecated.static String
Deprecated.static String
Deprecated.static String
simpleClassNameOf
(Class<?> clazz) Deprecated.static File
Deprecated.static com.github.dakusui.actionunit.core.Action
trivialAction
(String name, Consumer<com.github.dakusui.actionunit.core.Context> contextConsumer) Deprecated.static InternalUtils
Deprecated.Returns the enum constant of this class with the specified name.static InternalUtils[]
values()
Deprecated.Returns an array containing the constants of this enum class, in the order they are declared.static RuntimeException
Deprecated.// @formatter:off Wraps a given exceptione
with a framework specific exception,AutotestException
.static void
Deprecated.Write a giventext
to afile
.
-
Method Details
-
values
Deprecated.Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Deprecated.Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
currentBranchName
Deprecated.Returns anOptional
of aString
that contains a branch name. This method internally callsInternalUtils#currentBranchNameFor(new File("."))
.- Returns:
- An
Optional
of branch nameString
. - See Also:
-
currentBranchNameFor
Deprecated.Returns an
Optional
of aString
that contains a branch name, if the givenprojectDir
has.git
directory and a current branch name of it can be retrieved. An exception will be thrown on a failure during this step.Otherwise, an empty
Optional
will be returned.- Returns:
- An
Optional
of branch nameString
.
-
isPresumablyRunningFromIDE
Deprecated. -
isRunUnderSurefire
Deprecated. -
isRunUnderPitest
Deprecated. -
composeResultMessageLine
@Deprecated public static String composeResultMessageLine(Class<?> testClass, String stageName, String line) Deprecated. -
projectDir
Deprecated. -
simpleClassNameOf
Deprecated. -
flattenIfSequential
@Deprecated public static Stream<com.github.dakusui.actionunit.core.Action> flattenIfSequential(com.github.dakusui.actionunit.core.Action a) Deprecated. -
shorten
Deprecated.A shorthand method ofshorten(string, 120)
.- Parameters:
string
- A string to be shortened.- Returns:
- A shortened string.
-
shorten
Deprecated.Shorten astring
to the specifiedlength
. In casestring
contains a carriage return (\r
), a substring from the beginning of thestring
to the position of the character will be returned.- Parameters:
string
- A string to be shortened.length
- A length to whichstring
to be shortened.- Returns:
- A shortened string.
-
mask
Deprecated. -
flattenSequentialAction
@Deprecated public static Stream<com.github.dakusui.actionunit.core.Action> flattenSequentialAction(com.github.dakusui.actionunit.core.Action action) Deprecated. -
date
Deprecated.Creates aDate
object from a string formatted withMMM/dd/yyyy
.Locale.US
is used to create aSimpleDateFormat
object.- Parameters:
dateString
- A string from which aDate
object is created.- Returns:
- A date object created from
dateString
.
-
now
Deprecated.Returns aDate
object from the current date.- Returns:
- A date object created from the current date.
-
dateToSafeString
Deprecated. -
concat
Deprecated.Concatenates given streams.- Type Parameters:
T
- The type of the values streamed by the givenstreams
.- Parameters:
streams
- Streams to be concatenated.- Returns:
- Concatenated stream.
-
createContext
Deprecated.Returns an action context for InsDog. The returned context is designed to print a proper message when each value in the action context is a variable store.- Returns:
- A created context.
-
printableConsumer
@Deprecated public static Consumer<com.github.dakusui.actionunit.core.Context> printableConsumer(String consumerName, Consumer<com.github.dakusui.actionunit.core.Context> consumer) Deprecated.Creates a consumer, which gives aconsumerName
, whentoString
method is called.- Parameters:
consumerName
- A name of the created consumer. Returned fromtoString
.consumer
- A consumer from which the returned object is created.- Returns:
- A consumer which executes the
accept
method of the consumer and returnsconsumerName
fortoString
.
-
action
@Deprecated public static com.github.dakusui.actionunit.core.Action action(String name, Consumer<com.github.dakusui.actionunit.core.Context> contextConsumer) Deprecated.Creates a leaf action, which executes theaccept
method ofcontextConsumer
. Inside this method, the givencontextConsumer
method is made printable using theprintableConsumer
method. Then it will be passed toActionSupport#leaf
method to turn it into an action.- Parameters:
name
- A name of the action.contextConsumer
- A consumer to define the behavior of the returned action.- Returns:
- A leaf action created from the
contextConsumer
.
-
trivialAction
@Deprecated public static com.github.dakusui.actionunit.core.Action trivialAction(String name, Consumer<com.github.dakusui.actionunit.core.Context> contextConsumer) Deprecated.Creates a trivial leaf action, which is the same as an action created byInternalUtils.action(String, Consumer<Context>)
.- Parameters:
name
- A name of the action.contextConsumer
- A consumer that defines the behavior of the action.
-
dateAfter
Deprecated.Returns a predicate that tests if the date given to it is after thedate
.- Parameters:
date
- The returned predicate returnstrue
if a given date is after this.- Returns:
- A predicate to check if a given date is after
date
.
-
isToStringOverridden
Deprecated.Checks if the givenobject
has atoString
method which overridesObject#toString
.- Parameters:
object
- An object to be checked.- Returns:
true
-toString
method is overridden /false
- otherwise.
-
wrap
Deprecated.// @formatter:off Wraps a given exception
e
with a framework specific exception,AutotestException
.This method has
RuntimeException
as return value type, however, this method will never return a value but throws an exception. The return type is defined to be able to write a caller code in the following style, which increases readability.try { doSomthing() } catch (SomeCheckedException e) { throw wrap(e); }
If a given exception
e
is aRuntimeException
, or anError
, it will not be wrapped, bute
will be directly thrown.// @formatter:on
- Parameters:
e
- An exception to be wrapped.- Returns:
- This method will never return any value.
-
writeTo
Deprecated.Write a given
text
to afile
. When thefile
already exists,text
will be appended to it.text
will be encoded intoUTF-8
since this method callsFiles.writeString(Path,String,OpenOption...)
internally.In case the
file
doesn't exist or its parent directories don't exist, this function will try to create them.On a failure, a runtime exception will be thrown.
- Parameters:
file
- A file to whichtext
is written to.text
- A data to be written.
-
removeFile
Deprecated.Removes a givenfile
, if exists. If it doesn't exist, this method does nothing. If thefile
is a directory, it must be empty. Otherwise, an exception will be thrown.- Parameters:
file
- A file to be deleted. Must not benull
.
-
reverse
Deprecated. -
materializeResource
Deprecated.Copies the contents of a resource file from the classpath to a temporary file- Parameters:
resourcePath
- A path to a resource on a class path to be materialized- Returns:
- a temporary file path containing the contents of the resource
-
materializeResource
Deprecated.Copies the contents of a resource file from the classpath to a specified output file.- Parameters:
output
- The output file to which the resource contents will be writtenresourcePath
- A path to a resource on a class path to be materialized
-
copyTo
Deprecated. -
temporaryDirectory
Deprecated.
-