Package org.jvnet.hudson.test
Interface RealJenkinsRule.Step
- All Superinterfaces:
Serializable
- Enclosing class:
- RealJenkinsRule
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
One step to run.
Since this thunk will be sent to a different JVM, it must be serializable. The test class will certainly not be serializable, so you cannot use an anonymous inner class. One idiom is a static method reference:
@Test public void stuff() throws Throwable { rr.then(YourTest::_stuff); } private static void _stuff(JenkinsRule r) throws Throwable { // as needed }If you need to pass and/or return values, you can still use a static method reference: try
RealJenkinsRule.runRemotely(Step2)
or RealJenkinsRule.runRemotely(StepWithReturnAndOneArg, Serializable)
etc.
(using XStreamSerializable
as needed).
Alternately, you could use a lambda:
@Test public void stuff() throws Throwable { rr.then(r -> { // as needed }); }In this case you must take care not to capture non-serializable objects from scope; in particular, the body must not use (named or anonymous) inner classes.
-
Method Summary
-
Method Details
-
run
- Throws:
Throwable
-