MCPcopy Create free account
hub / github.com/ReadyTalk/avian / unwindTest

Method unwindTest

test/extra/DynamicWind.java:22–71  ·  view source on GitHub ↗
(final Callable<Integer> unwind)

Source from the content-addressed store, hash-verified

20 }
21
22 private void unwindTest(final Callable<Integer> unwind) throws Exception {
23 System.out.println("unwindTest enter");
24
25 try {
26 expect(dynamicWind(new Runnable() {
27 public void run() {
28 System.out.println("unwindTest before");
29
30 expect(before == 0);
31 expect(task == 0);
32 expect(after == 0);
33
34 before = 1;
35 }
36 }, new Callable<Integer>() {
37 public Integer call() throws Exception {
38 System.out.println("unwindTest thunk");
39
40 expect(before == 1);
41 expect(task == 0);
42 expect(after == 0);
43
44 task = 1;
45
46 return unwind.call();
47 }
48 },
49 new Runnable() {
50 public void run() {
51 System.out.println("unwindTest after");
52
53 expect(before == 1);
54 expect(task == 1);
55 expect(after == 0);
56
57 after = 1;
58 }
59 }) == 42);
60 } catch (MyException e) {
61 e.printStackTrace();
62 }
63
64 System.out.println("unwindTest expect");
65
66 expect(before == 1);
67 expect(task == 1);
68 expect(after == 1);
69
70 System.out.println("unwindTest exit");
71 }
72
73 private void normalUnwind() throws Exception {
74 unwindTest(new Callable<Integer>() {

Callers 6

normalUnwindMethod · 0.95
exceptionUnwindMethod · 0.95
callMethod · 0.95
runMethod · 0.80

Calls 4

expectMethod · 0.95
printStackTraceMethod · 0.80
printlnMethod · 0.45
dynamicWindMethod · 0.45

Tested by

no test coverage detected