content.txt
1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
!3 System Under Test
'''Currently only available in Java'''
!-Using SystemUnderTest allows you to let SliM directly invoke a method on your SystemUnderTest without having to create a method in a SliM fixture for it.-!
!4 Example
{{{
import fitnesse.slim.SystemUnderTest;
/**
* The slim fixture.
*/
public class SlimDriver {
// field MUST be declared PUBLIC
@SystemUnderTest
public Service service = new Service();
public void init() {
Database.clean();
}
}
/**
* The service under test.
*/
public class Service {
public void createPerson(String name) {
Database.persist(new Person("name"));
}
public boolean exists(String name) {
return Database.get(name) != null;
}
}
}}}
With the !-@SystemUnderTest-! annotation you can now say:
!|script|SlimDriver|
|init|
|create person|Ben Vonk|
|ensure|exists|Ben Vonk|
When a method that should be invoked on the !-SliM-! fixture is missing, it will try to invoke that method on a '''public''' field annotated with !-SystemUnderTest-!.