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