@TableId("foo")public TableData getTableData() {// create you strongly typed table data here}@Test@TableRef("foo")public void someMethod(User user){}
public TableData getTableData() {// create you strongly typed table data here}@Test@LoadTableData(from(method(on(TestClass).getTableData())))public void someMethod(User user){}
public TableData someMethodData() {// create you strongly typed table data here}@Testpublic void someMethod(User user){}
public void templateMethodToRegisterThings(Container container) {
container.addInstance(Properties.class, loadSomeTestPropertiesOrWhatever());
}
@Test
public void someMethod(ArbitrarilyComplexTestData data) {
}
public static class ArbitrarilyComplexTestData {
public ArbitrarilyComplexTestData(Properties properties) {
...whatever...
}
}
If you also added an AnnotationsOnTestScopeContainer, then you could have ArbitrarilyComplexTestData instances constructed with parameters:
@Test
@TestValue(name = "fred")
@TestValue(age = "21")
public void someMethod(ArbitrarilyComplexTestData data) {
}
and
public static class ArbitrarilyComplexTestData {
public ArbitrarilyComplexTestData(AnnotationValues values) {
this.name = values.get("name");
this.age = values.get("age");
}
}
or maybe pass a map instead of 'AnnotationValues'.
Inspired by what you did for given/when/then in Propidle Matt.
On 19 Dec 2011, at 08:42, Daniel Worthington-Bodart wrote:
> My ideas were pretty basic but maybe one of these:
>
> @TableId("foo")
> public TableData getTableData() {
> // create you strongly typed table data here
> }
>
> @Test
> @TableRef("foo")
> public void someMethod(User user){
>
> }
>
> or if this is possible
>
> public TableData getTableData() {
> // create you strongly typed table data here
> }
>
> @Test
> @LoadTableData(from(method(on(TestClass).getTableData())))
> public void someMethod(User user){
>
> }
>
>
> or we could just go naming convention like JUnit3
>
>
> public TableData someMethodData() {
> // create you strongly typed table data here
> }
>
> @Test
> public void someMethod(User user){
>
> }
>
>
>
>
>
>
>
> On 19 December 2011 07:45, Matt Savage <matthew...@gmail.com> wrote: