1 package mockit.integration.junit4;
2
3 import java.util.IllegalFormatCodePointException;
4
5 import mockit.Expectations;
6 import mockit.Mocked;
7 import mockit.integration.Collaborator;
8
9 import org.junit.Ignore;
10 import org.junit.Test;
11
12
13 @Ignore
14 public final class JUnit4ViolatedExpectationsTest {
15 @Test
16 public void expectInvocationWhichDoesNotOccurInTestedCodeThatThrowsAnException_1(@Mocked final Collaborator mock) {
17 new Expectations() {
18 {
19 mock.doSomething();
20 }
21 };
22 }
23
24 @Test
25 public void expectInvocationWhichDoesNotOccurInTestedCodeThatThrowsAnException_2(@Mocked final Collaborator mock) {
26 new Expectations() {
27 {
28 mock.doSomething();
29 result = new IllegalFormatCodePointException('x');
30 }
31 };
32
33 mock.doSomething();
34 }
35
36
37 @Test(expected = IllegalFormatCodePointException.class)
38 public void expectInvocationWhichDoesNotOccurInTestedCodeThatThrowsAnException_4(@Mocked final Collaborator mock) {
39 new Expectations() {
40 {
41 mock.doSomething();
42 result = new IllegalFormatCodePointException('x');
43 minTimes = 2;
44 }
45 };
46
47 mock.doSomething();
48 }
49
50 @Test(expected = AssertionError.class)
51 public void expectInvocationWhichDoesNotOccurInTestedCodeThatThrowsAnException_5(@Mocked final Collaborator mock) {
52 new Expectations() {
53 {
54 mock.doSomething();
55 result = new IllegalFormatCodePointException('x');
56 }
57 };
58
59 mock.doSomething();
60 }
61
62 @Test(expected = AssertionError.class)
63 public void expectInvocationWhichDoesNotOccurInTestedCodeThatThrowsAnException_6(@Mocked final Collaborator mock) {
64 new Expectations() {
65 {
66 mock.doSomething();
67 result = new IllegalFormatCodePointException('x');
68 }
69 };
70 }
71 }