public class ApplicationLauncher extends Object
Executes a Java application from a class that has a "main" method.
The following example shows how to start an application without any arguments:
ApplicationLauncher.application(JavaApp.class).start(); // or ApplicationLauncher.application
("org.assertj.swing.application.JavaApp").start
();
The following example shows how to start an application with arguments:
ApplicationLauncher.application
(JavaApp.class).withArgs
("arg1", "arg2").start
(); // or ApplicationLauncher.application
("org.assertj.swing.application.JavaApp").withArgs
("arg1", "arg2").start
();
Modifier and Type | Method and Description |
---|---|
static ApplicationLauncher |
application(Class<?> applicationType)
Starting point of the fluent interface.
|
static ApplicationLauncher |
application(String applicationTypeName)
Starting point of the fluent interface.
|
void |
start()
Starts the application.
|
ApplicationLauncher |
withArgs(String... newArgs)
Specifies the arguments to pass to the "main" method.
|
@Nonnull public static ApplicationLauncher application(@Nonnull String applicationTypeName)
applicationTypeName
- the fully qualified name of the class containing the "main" method.ApplicationStarter
.UnexpectedException
- if the class specified in the given name cannot be loaded.@Nonnull public static ApplicationLauncher application(@Nonnull Class<?> applicationType)
applicationType
- the class containing the "main" method.ApplicationStarter
.@Nonnull public ApplicationLauncher withArgs(@Nonnull String... newArgs)
newArgs
- the arguments to pass to the "main" method.ApplicationStarter
.NullPointerException
- if newArgs
is null
.public void start()
org.fest.reflect.exception.ReflectionError
- if the "main" method cannot be invoked.Copyright © 2014–2019 AssertJ. All rights reserved.