Last active
January 16, 2018 21:09
-
-
Save finsterthecat/ab811eefb5e208db7bc8c3778cbff709 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@RunWith(SpringRunner.class) | |
@SpringBootTest | |
@AutoConfigureMockMvc | |
@ActiveProfiles("test") | |
public class HeroesBackendApplicationTests { | |
private static final String BASE_URL = "/heroes/"; | |
private static final Logger LOG = LoggerFactory.getLogger(HeroesBackendApplicationTests.class); | |
@Autowired | |
JdbcTemplate jdbcTemplate; | |
@Autowired | |
private MockMvc mvc; | |
// Used for converting heroes to/from JSON | |
private ObjectMapper mapper = new ObjectMapper(); | |
/** | |
* Initialize mocks and delete all rows from Hero prior to each test. | |
*/ | |
@Before | |
public void initTests() { | |
// Always start from known state, in this case 1 row in hero table. | |
jdbcTemplate.execute("delete from hero; insert into Hero(name) values ('Superman');"); | |
} | |
@Test | |
public void contextLoads() { | |
assertThat(jdbcTemplate).isNotNull(); | |
assertThat(mvc).isNotNull(); | |
} | |
//Insert tests here... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment