org.mockito.internal.progress.ThreadSafeMockingProgress Java Examples
The following examples show how to use
org.mockito.internal.progress.ThreadSafeMockingProgress.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InjectMembersRule.java From morf with Apache License 2.0 | 6 votes |
/** * @see org.junit.rules.MethodRule#apply(org.junit.runners.model.Statement, org.junit.runners.model.FrameworkMethod, java.lang.Object) */ @Override public Statement apply(final Statement base, final FrameworkMethod method, final Object target) { return new Statement() { @Override public void evaluate() throws Throwable { final List<Module> moduleWithTarget = new ArrayList<>(Arrays.asList(modules)); if (target instanceof Module) { moduleWithTarget.add((Module) target); } Guice.createInjector(moduleWithTarget).injectMembers(target); try { base.evaluate(); } finally { new ThreadSafeMockingProgress().reset(); } } }; }
Example #2
Source File: MockitoTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void shouldRemoveStubbableFromProgressAfterStubbing() { List mock = Mockito.mock(List.class); Mockito.when(mock.add("test")).thenReturn(true); //TODO Consider to move to separate test assertNull(new ThreadSafeMockingProgress().pullOngoingStubbing()); }
Example #3
Source File: MockitoTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void shouldRemoveStubbableFromProgressAfterStubbing() { List mock = Mockito.mock(List.class); Mockito.when(mock.add("test")).thenReturn(true); //TODO Consider to move to separate test assertNull(new ThreadSafeMockingProgress().pullOngoingStubbing()); }
Example #4
Source File: MockHandler.java From astor with GNU General Public License v2.0 | 4 votes |
public MockHandler(MockSettingsImpl mockSettings) { this.mockSettings = mockSettings; this.mockingProgress = new ThreadSafeMockingProgress(); this.matchersBinder = new MatchersBinder(); this.invocationContainerImpl = new InvocationContainerImpl(mockingProgress); }
Example #5
Source File: WarningsCollector.java From astor with GNU General Public License v2.0 | 4 votes |
public WarningsCollector() { createdMocks = new LinkedList(); MockingProgress progress = new ThreadSafeMockingProgress(); progress.setListener(new CollectCreatedMocks(createdMocks)); }
Example #6
Source File: MockHandlerImpl.java From astor with GNU General Public License v2.0 | 4 votes |
public MockHandlerImpl(MockCreationSettings mockSettings) { this.mockSettings = mockSettings; this.mockingProgress = new ThreadSafeMockingProgress(); this.matchersBinder = new MatchersBinder(); this.invocationContainerImpl = new InvocationContainerImpl(mockingProgress, mockSettings); }
Example #7
Source File: WarningsCollector.java From astor with GNU General Public License v2.0 | 4 votes |
public WarningsCollector() { createdMocks = new LinkedList(); MockingProgress progress = new ThreadSafeMockingProgress(); progress.setListener(new CollectCreatedMocks(createdMocks)); }
Example #8
Source File: MockitoMisusingUnitTest.java From tutorials with MIT License | 4 votes |
@After public void tearDown() { ThreadSafeMockingProgress.mockingProgress().reset(); }