How to use method of org.easymock.internal.MocksBehavior class

Best Easymock code snippet using org.easymock.internal.MocksBehavior.

Run Easymock automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

copy
1/**
2 * Copyright 2001-2013 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.easymock.tests;
17
18import org.easymock.internal.MocksBehavior;
19import org.easymock.internal.Range;
20import org.easymock.internal.ReplayState;
21import org.easymock.internal.RuntimeExceptionWrapper;
22import org.junit.Before;
23import org.junit.Test;
24
25/**
26 * @author OFFIS, Tammo Freese
27 */
28public class ReplayStateInvalidCallsTest {
29
30    private ReplayState control;
31
32    private Exception exception;
33
34    @Before
35    public void setUp() {
36        exception = new Exception();
37        control = new ReplayState(new MocksBehavior(false));
38    }
39
40    @Test(expected = RuntimeExceptionWrapper.class)
41    public void expectAndThrowLongWithMinMax() {
42        control.andThrow(exception);
43    }
44
45    @Test(expected = RuntimeExceptionWrapper.class)
46    public void expectAndReturnObjectWithMinMax() {
47        control.andReturn("");
48    }
49
50    @Test(expected = RuntimeExceptionWrapper.class)
51    public void asStub() {
52        control.asStub();
53    }
54
55    @Test(expected = RuntimeExceptionWrapper.class)
56    public void setDefaultReturnValue() {
57        control.setDefaultReturnValue("");
58    }
59
60    @Test(expected = RuntimeExceptionWrapper.class)
61    public void setDefaultThrowable() {
62        control.setDefaultThrowable(exception);
63    }
64
65    @Test(expected = RuntimeExceptionWrapper.class)
66    public void setDefaultVoidCallable() {
67        control.setDefaultVoidCallable();
68    }
69
70    @Test(expected = RuntimeExceptionWrapper.class)
71    public void replay() {
72        control.replay();
73    }
74
75    @Test(expected = RuntimeExceptionWrapper.class)
76    public void checkOrder() {
77        control.checkOrder(true);
78    }
79
80    @Test(expected = RuntimeExceptionWrapper.class)
81    public void makeThreadSafe() {
82        control.makeThreadSafe(true);
83    }
84
85    @Test(expected = RuntimeExceptionWrapper.class)
86    public void andStubReturn() {
87        control.andStubReturn("7");
88    }
89
90    @Test(expected = RuntimeExceptionWrapper.class)
91    public void andStubThrow() {
92        control.andStubThrow(new RuntimeException());
93    }
94
95    @Test(expected = RuntimeExceptionWrapper.class)
96    public void andStubAnswer() {
97        control.andStubAnswer(null);
98    }
99
100    @Test(expected = RuntimeExceptionWrapper.class)
101    public void andStubDelegateTo() {
102        control.andStubDelegateTo(null);
103    }
104
105    @Test(expected = RuntimeExceptionWrapper.class)
106    public void times() {
107        control.times(new Range(0, 1));
108    }
109
110    @Test(expected = RuntimeExceptionWrapper.class)
111    public void callback() {
112        control.callback(new Runnable() {
113            public void run() {
114            };
115        });
116    }
117
118    @Test(expected = RuntimeExceptionWrapper.class)
119    public void andReturn() {
120        control.andReturn(null);
121    }
122
123    @Test(expected = RuntimeExceptionWrapper.class)
124    public void andThrow() {
125        control.andThrow(new RuntimeException());
126    }
127
128    @Test(expected = RuntimeExceptionWrapper.class)
129    public void andAnswer() {
130        control.andAnswer(null);
131    }
132
133    @Test(expected = RuntimeExceptionWrapper.class)
134    public void andDelegateTo() {
135        control.andDelegateTo(null);
136    }
137
138    @Test(expected = RuntimeExceptionWrapper.class)
139    public void defaultThrowable() {
140        control.setDefaultThrowable(new RuntimeException());
141    }
142
143    @Test(expected = RuntimeExceptionWrapper.class)
144    public void defaultReturnValue() {
145        control.setDefaultReturnValue(null);
146    }
147
148    @Test(expected = RuntimeExceptionWrapper.class)
149    public void defaultVoidCallable() {
150        control.setDefaultVoidCallable();
151    }
152}
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger code on LambdaTest Cloud Grid

Execute automation tests with on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)