本文整理汇总了Java中rx.observers.AssertableSubscriber.assertReceivedOnNext方法的典型用法代码示例。如果您正苦于以下问题:Java AssertableSubscriber.assertReceivedOnNext方法的具体用法?Java AssertableSubscriber.assertReceivedOnNext怎么用?Java AssertableSubscriber.assertReceivedOnNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.observers.AssertableSubscriber
的用法示例。
在下文中一共展示了AssertableSubscriber.assertReceivedOnNext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ARAR_ResultIn01010Counter
import rx.observers.AssertableSubscriber; //导入方法依赖的package包/类
@Test
public void ARAR_ResultIn01010Counter() {
ItemId itemId = mock(ItemId.class);
when(api.addItem(itemId)).thenReturn(Single.just(ApiResponse.createSuccessfulResponse()));
when(api.removeItem(itemId)).thenReturn(Single.just(ApiResponse.createSuccessfulResponse()));
AssertableSubscriber<Integer> counterTestSubscriber = itemRepository.getCounter().test();
itemRepository.addItem(itemId).test();
itemRepository.removeItem(itemId).test();
itemRepository.addItem(itemId).test();
itemRepository.removeItem(itemId).test();
RxJavaSchedulerUtils.advanceOneSecond();
counterTestSubscriber.assertReceivedOnNext(Arrays.asList(0, 1, 0, 1, 0));
}
示例2: AR_ResultIn0101Counter_When_LastRemovalFails
import rx.observers.AssertableSubscriber; //导入方法依赖的package包/类
@Test
public void AR_ResultIn0101Counter_When_LastRemovalFails() {
ItemId itemId = mock(ItemId.class);
when(api.addItem(itemId)).thenReturn(Single.just(ApiResponse.createSuccessfulResponse()));
when(api.removeItem(itemId)).thenReturn(Single.just(
ApiResponse.createFailedResponse(HttpStatus.BAD_REQUEST.value(), mock(ApiResponse.ApiError.class))));
AssertableSubscriber<Integer> counterTestSubscriber = itemRepository.getCounter().test();
itemRepository.addItem(itemId).test();
itemRepository.removeItem(itemId).test();
RxJavaSchedulerUtils.advanceOneSecond();
counterTestSubscriber.assertReceivedOnNext(Arrays.asList(0, 1, 0, 1));
}
示例3: AR_ResultIn010Counter
import rx.observers.AssertableSubscriber; //导入方法依赖的package包/类
@Test
public void AR_ResultIn010Counter() {
ItemId itemId = mock(ItemId.class);
when(api.addItem(itemId)).thenReturn(Single.just(ApiResponse.createSuccessfulResponse()));
when(api.removeItem(itemId)).thenReturn(Single.just(ApiResponse.createSuccessfulResponse()));
AssertableSubscriber<Integer> counterTestSubscriber = itemRepository.getCounter().test();
itemRepository.addItem(itemId).test();
itemRepository.removeItem(itemId).test();
RxJavaSchedulerUtils.advanceOneSecond();
counterTestSubscriber.assertReceivedOnNext(Arrays.asList(0, 1, 0));
}
示例4: AR_ResultIn0101Counter_When_LastRemovalThrows
import rx.observers.AssertableSubscriber; //导入方法依赖的package包/类
@Test
public void AR_ResultIn0101Counter_When_LastRemovalThrows() {
ItemId itemId = mock(ItemId.class);
when(api.addItem(itemId)).thenReturn(Single.just(ApiResponse.createSuccessfulResponse()));
when(api.removeItem(itemId)).thenReturn(Single.error(new RuntimeException()));
AssertableSubscriber<Integer> counterTestSubscriber = itemRepository.getCounter().test();
itemRepository.addItem(itemId).test();
itemRepository.removeItem(itemId).test();
RxJavaSchedulerUtils.advanceOneSecond();
counterTestSubscriber.assertReceivedOnNext(Arrays.asList(0, 1, 0, 1));
}
示例5: Add_ResultIn010Counter_When_AdditionFails
import rx.observers.AssertableSubscriber; //导入方法依赖的package包/类
@Test
public void Add_ResultIn010Counter_When_AdditionFails() {
ItemId itemId = mock(ItemId.class);
when(api.addItem(itemId)).thenReturn(Single.just(ApiResponse.createFailedResponse(
HttpStatus.BAD_REQUEST.value(), mock(ApiResponse.ApiError.class))));
AssertableSubscriber<Integer> counterTestSubscriber = itemRepository.getCounter().test();
itemRepository.addItem(itemId).test();
RxJavaSchedulerUtils.advanceOneSecond();
counterTestSubscriber.assertReceivedOnNext(Arrays.asList(0, 1, 0));
}
示例6: Add_ResultIn01Counter
import rx.observers.AssertableSubscriber; //导入方法依赖的package包/类
@Test
public void Add_ResultIn01Counter() {
ItemId itemId = mock(ItemId.class);
when(api.addItem(itemId)).thenReturn(Single.just(ApiResponse.createSuccessfulResponse()));
AssertableSubscriber<Integer> counterTestSubscriber = itemRepository.getCounter().test();
itemRepository.addItem(itemId).test();
RxJavaSchedulerUtils.advanceOneSecond();
counterTestSubscriber.assertReceivedOnNext(Arrays.asList(0, 1));
}
示例7: Add_ResultIn010Counter_When_ExceptionIsThrown
import rx.observers.AssertableSubscriber; //导入方法依赖的package包/类
@Test
public void Add_ResultIn010Counter_When_ExceptionIsThrown() {
ItemId itemId = mock(ItemId.class);
when(api.addItem(itemId)).thenReturn(Single.error(new RuntimeException()));
AssertableSubscriber<Integer> counterTestSubscriber = itemRepository.getCounter().test();
itemRepository.addItem(itemId).test();
RxJavaSchedulerUtils.advanceOneSecond();
counterTestSubscriber.assertReceivedOnNext(Arrays.asList(0, 1, 0));
}