Created
May 21, 2017 17:46
-
-
Save jogaco/5223b4c4a8535fa4f4d2e73dac4ef92a to your computer and use it in GitHub Desktop.
Spring Boot Tutorial: tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.operatornew.gamemanager; | |
import com.operatornew.gamemanager.domain.Game; | |
import com.operatornew.gamemanager.repository.GameRepository; | |
import java.util.ArrayList; | |
import java.util.List; | |
import static org.junit.Assert.assertEquals; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.context.SpringBootTest; | |
import org.springframework.test.context.junit4.SpringRunner; | |
@RunWith(SpringRunner.class) | |
@SpringBootTest | |
public class SpringBootMysqlApplicationTests { | |
@Autowired | |
private GameRepository gameRepository; | |
@Test | |
public void testLoadGames() { | |
List<Game> games = (ArrayList<Game>) gameRepository.findAll(); | |
assertEquals("Did not get all games", 3, games.size()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment