1/*
2 * Copyright (c) 2007 Mockito contributors
3 * This program is made available under the terms of the MIT License.
4 */
5package org.mockito.internal.progress;
6
7import org.junit.After;
8import org.junit.Test;
9import org.mockito.internal.verification.DummyVerificationMode;
10import org.mockitoutil.TestBase;
11
12import java.util.List;
13
14import static junit.framework.TestCase.assertNotNull;
15import static org.mockito.Mockito.mock;
16import static org.mockito.Mockito.verify;
17import static org.mockito.internal.progress.ThreadSafeMockingProgress.mockingProgress;
18
19public class ThreadSafeMockingProgressTest extends TestBase {
20
21    @After
22    public void after() {
23        this.resetState();
24    }
25
26    @Test
27    public void shouldShareState() throws Exception {
28        //given
29        MockingProgress p = mockingProgress();
30        p.verificationStarted(new DummyVerificationMode());
31
32        //then
33        p = mockingProgress();
34        assertNotNull(p.pullVerificationMode());
35    }
36
37    @Test
38    public void shouldKnowWhenVerificationHasStarted() throws Exception {
39        //given
40        verify(mock(List.class));
41        MockingProgress p = mockingProgress();
42
43        //then
44        assertNotNull(p.pullVerificationMode());
45    }
46}
47