Skip to content

Commit

Permalink
test(sample-app): correct unit test for API
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Oct 20, 2020
1 parent bd9874e commit 1a367a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
package com.jmsoftware.boot.mediastreamingsampleapp;

import com.jmframework.boot.mediastreamingspringbootautoconfigure.model.Video;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.EntityExchangeResult;
import org.springframework.test.web.reactive.server.WebTestClient;

import java.util.List;

/**
* Description: MediaStreamingSampleAppApplicationTests, change description here.
*
* @author Johnny Miller (锺俊), email: [email protected], date: 10/20/2020 1:04 PM
**/
@Slf4j
@WebFluxTest
@SpringBootTest
@AutoConfigureWebTestClient
class MediaStreamingSampleAppApplicationTests {
@Autowired
private WebTestClient webTestClient;

@Test
void videosTest() {
webTestClient.get().uri("/videos").exchange().expectStatus().isOk();
EntityExchangeResult<List<Video>> returnResult = webTestClient
.get()
.uri("/videos")
.accept(MediaType.ALL)
.exchange()
.expectStatus()
.isOk()
.expectBodyList(Video.class)
.returnResult();
log.info("Video test: {}", returnResult.getResponseBody());
}
}

This file was deleted.

0 comments on commit 1a367a6

Please sign in to comment.