How to use method of org.jmock.test.unit.internal.ChangeStateSideEffectTests class

Best Jmock-library code snippet using org.jmock.test.unit.internal.ChangeStateSideEffectTests.

Run Jmock-library automation tests on LambdaTest cloud grid

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

copy
1package org.jmock.test.unit.internal;
2
3import junit.framework.TestCase;
4
5import org.hamcrest.Description;
6import org.hamcrest.StringDescription;
7import org.jmock.internal.ChangeStateSideEffect;
8import org.jmock.internal.State;
9
10
11public class ChangeStateSideEffectTests extends TestCase {
12    FakeState state = new FakeState();
13    ChangeStateSideEffect sideEffect = new ChangeStateSideEffect(state);
14
15    public void testActivatesTheGivenState() {
16        
17        state.isActive = false;
18        sideEffect.perform();
19        assertTrue("state should be active", state.isActive);
20    }
21    
22    public void testDescribesItselfInTermsOfTheActivatedState() {
23        state.descriptionText = "the-new-state";
24        
25        assertEquals("description", "then the-new-state", StringDescription.toString(sideEffect));
26    }
27    
28    class FakeState implements State {
29        public boolean isActive = false;
30        
31        public void activate() {
32            isActive = true;
33        }
34
35        public boolean isActive() {
36            return isActive;
37        }
38
39        public String descriptionText;
40        public void describeTo(Description description) {
41            description.appendText(descriptionText);
42        }
43    }
44}
45
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)