当前位置: 首页>>代码示例>>Java>>正文


Java AssertableSubscriber.assertReceivedOnNext方法代码示例

本文整理汇总了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));
}
 
开发者ID:NikitaKozlov,项目名称:Switchman,代码行数:18,代码来源:ItemRepositoryTest_Part3_CounterChanges.java

示例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));
}
 
开发者ID:NikitaKozlov,项目名称:Switchman,代码行数:17,代码来源:ItemRepositoryTest_Part3_CounterChanges.java

示例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));
}
 
开发者ID:NikitaKozlov,项目名称:Switchman,代码行数:16,代码来源:ItemRepositoryTest_Part3_CounterChanges.java

示例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));
}
 
开发者ID:NikitaKozlov,项目名称:Switchman,代码行数:16,代码来源:ItemRepositoryTest_Part3_CounterChanges.java

示例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));
}
 
开发者ID:NikitaKozlov,项目名称:Switchman,代码行数:15,代码来源:ItemRepositoryTest_Part3_CounterChanges.java

示例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));
}
 
开发者ID:NikitaKozlov,项目名称:Switchman,代码行数:14,代码来源:ItemRepositoryTest_Part3_CounterChanges.java

示例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));
}
 
开发者ID:NikitaKozlov,项目名称:Switchman,代码行数:14,代码来源:ItemRepositoryTest_Part3_CounterChanges.java


注:本文中的rx.observers.AssertableSubscriber.assertReceivedOnNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。