Reactor系列(十九)StepVerifier測試

java#reactor#flux#StepVerifier

測試java

視頻講解: https://www.bilibili.com/vide...react


FluxMonoTestCase.javaapi

package com.example.reactor;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;

@Slf4j
public class FluxMonoTestCase extends BaseTestCase {
   @Test
   public void verify(){
       Flux<Integer> integerFlux = Flux.range(1,5);
       integerFlux.subscribe(x ->System.out.print("->"+x));
       StepVerifier.create(integerFlux)
               .expectNext(1)
               .expectNext(2)
               .expectNext(3,4,5)
               .expectComplete()
               .verify();
   }
}

公衆號,堅持天天3分鐘視頻學習
ide

相關文章
相關標籤/搜索