org.sodatest.api.java.reflection
Class ReflectiveSodaFixtureForJava
java.lang.Object
org.sodatest.api.java.reflection.ReflectiveSodaFixtureForJava
- All Implemented Interfaces:
- org.sodatest.api.reflection.ReflectiveSodaFixture, org.sodatest.api.SodaFixture, scala.ScalaObject
public abstract class ReflectiveSodaFixtureForJava
- extends Object
- implements org.sodatest.api.reflection.ReflectiveSodaFixture
Java SodaFixture base class that supports the discovery of SodaEvents
and SodaReports by reflecting on the subclass' functions.
ReflectiveSodaFixtureForJava is probably the easiest way to implement the SodaFixture
interface in a Java environment.
Simply extend this class and then define in the subclass public methods that have no parameters
and which return either a SodaEvent or SodaReport as required.
ReflectiveSodaFixtureForJava will canonize the incoming Event or Report name and then discover and invoke
a method on the subclass that has a name which, when also canonized, matches the Event or
Report name.
(Names in SodaTest are canonized by removing all non-alpha-numeric characters and
converting all alpha characters to lower-case. e.g. canonized("Secret Report #2") -> "secretreport2")
Example
public class MyFixutre extends ReflectiveSodaFixtureForJava {
public SodaReport secretReport2() {
return new SecretReport2();
}
}
| Nested classes/interfaces inherited from interface org.sodatest.api.SodaFixture |
org.sodatest.api.SodaFixture.$anon$1, org.sodatest.api.SodaFixture.$anon$2 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReflectiveSodaFixtureForJava
public ReflectiveSodaFixtureForJava()
createEvent
public scala.Option<org.sodatest.api.SodaEvent> createEvent(String name)
- Specified by:
createEvent in interface org.sodatest.api.reflection.ReflectiveSodaFixture- Specified by:
createEvent in interface org.sodatest.api.SodaFixture
createReport
public scala.Option<org.sodatest.api.SodaReport> createReport(String name)
- Specified by:
createReport in interface org.sodatest.api.reflection.ReflectiveSodaFixture- Specified by:
createReport in interface org.sodatest.api.SodaFixture
Copyright © 2010-2011 Belmont Technology Pty Ltd. All Rights Reserved.