use of org.mockito.InOrder in project hadoop by apache.
the class TestFind method processArgumentsNoDescend.
// check expressions are called in the correct order
@Test
public void processArgumentsNoDescend() throws IOException {
LinkedList<PathData> items = createDirectories();
Find find = new Find();
find.setConf(conf);
PrintStream out = mock(PrintStream.class);
find.getOptions().setOut(out);
PrintStream err = mock(PrintStream.class);
find.getOptions().setErr(err);
Expression expr = mock(Expression.class);
when(expr.apply((PathData) any(), anyInt())).thenReturn(Result.PASS);
when(expr.apply(eq(item1a), anyInt())).thenReturn(Result.STOP);
FileStatusChecker fsCheck = mock(FileStatusChecker.class);
Expression test = new TestExpression(expr, fsCheck);
find.setRootExpression(test);
find.processArguments(items);
InOrder inOrder = inOrder(expr);
inOrder.verify(expr).setOptions(find.getOptions());
inOrder.verify(expr).prepare();
inOrder.verify(expr).apply(item1, 0);
inOrder.verify(expr).apply(item1a, 1);
inOrder.verify(expr).apply(item1b, 1);
inOrder.verify(expr).apply(item2, 0);
inOrder.verify(expr).apply(item3, 0);
inOrder.verify(expr).apply(item4, 0);
inOrder.verify(expr).apply(item5, 0);
inOrder.verify(expr).apply(item5a, 1);
inOrder.verify(expr).apply(item5b, 1);
inOrder.verify(expr).apply(item5c, 1);
inOrder.verify(expr).apply(item5ca, 2);
inOrder.verify(expr).apply(item5d, 1);
inOrder.verify(expr).apply(item5e, 1);
inOrder.verify(expr).finish();
verifyNoMoreInteractions(expr);
InOrder inOrderFsCheck = inOrder(fsCheck);
inOrderFsCheck.verify(fsCheck).check(item1.stat);
inOrderFsCheck.verify(fsCheck).check(item1a.stat);
inOrderFsCheck.verify(fsCheck).check(item1b.stat);
inOrderFsCheck.verify(fsCheck).check(item2.stat);
inOrderFsCheck.verify(fsCheck).check(item3.stat);
inOrderFsCheck.verify(fsCheck).check(item4.stat);
inOrderFsCheck.verify(fsCheck).check(item5.stat);
inOrderFsCheck.verify(fsCheck).check(item5a.stat);
inOrderFsCheck.verify(fsCheck).check(item5b.stat);
inOrderFsCheck.verify(fsCheck).check(item5c.stat);
inOrderFsCheck.verify(fsCheck).check(item5ca.stat);
inOrderFsCheck.verify(fsCheck).check(item5d.stat);
inOrderFsCheck.verify(fsCheck).check(item5e.stat);
verifyNoMoreInteractions(fsCheck);
verifyNoMoreInteractions(out);
verifyNoMoreInteractions(err);
}
use of org.mockito.InOrder in project Store by NYTimes.
the class FilePersisterTest method writeThenRead.
@Test
public void writeThenRead() throws IOException {
when(fileSystem.read(resolvedPath)).thenReturn(bufferedSource);
when(fileSystem.exists(resolvedPath)).thenReturn(true);
fileSystemPersister.write(simple, bufferedSource).toBlocking().single();
BufferedSource source = fileSystemPersister.read(simple).toBlocking().first();
InOrder inOrder = inOrder(fileSystem);
inOrder.verify(fileSystem).write(resolvedPath, bufferedSource);
inOrder.verify(fileSystem).exists(resolvedPath);
inOrder.verify(fileSystem).read(resolvedPath);
assertThat(source).isEqualTo(bufferedSource);
}
use of org.mockito.InOrder in project Store by NYTimes.
the class FileSystemRecordPersisterTest method writeThenRead.
@Test
public void writeThenRead() throws IOException {
when(fileSystem.read(resolvedPath)).thenReturn(bufferedSource);
when(fileSystem.exists(resolvedPath)).thenReturn(true);
fileSystemPersister.write(simple, bufferedSource).toBlocking().single();
BufferedSource source = fileSystemPersister.read(simple).toBlocking().first();
InOrder inOrder = inOrder(fileSystem);
inOrder.verify(fileSystem).write(resolvedPath, bufferedSource);
inOrder.verify(fileSystem).exists(resolvedPath);
inOrder.verify(fileSystem).read(resolvedPath);
assertThat(source).isEqualTo(bufferedSource);
}
use of org.mockito.InOrder in project sonarqube by SonarSource.
the class UserSessionFilterTest method doFilter_loads_and_unloads_settings.
@Test
public void doFilter_loads_and_unloads_settings() throws Exception {
mockNoUserSessionInitializer();
underTest.doFilter(request, response, chain);
InOrder inOrder = inOrder(settings);
inOrder.verify(settings).load();
inOrder.verify(settings).unload();
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableTests method testJustWithScheduler.
@Test
public void testJustWithScheduler() {
TestScheduler scheduler = new TestScheduler();
Flowable<Integer> observable = Flowable.fromArray(1, 2).subscribeOn(scheduler);
Subscriber<Integer> observer = TestHelper.mockSubscriber();
observable.subscribe(observer);
scheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onNext(1);
inOrder.verify(observer, times(1)).onNext(2);
inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
Aggregations