Update to junit5/assert4j in batch sample

Fixes #127
This commit is contained in:
Mark Pollack
2020-01-15 10:39:02 -05:00
parent 42f83b10c8
commit f205626b4f
8 changed files with 57 additions and 82 deletions

View File

@@ -0,0 +1,26 @@
package io.spring.billsetuptask;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
class BillSetupTaskApplicationTests {
@Autowired
private DataSource dataSource;
@Test
public void testRepository() {
JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource);
int result = jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM BILL_STATEMENTS", Integer.class);
assertThat(result).isEqualTo(0);
}
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring.billsetuptask;
import javax.sql.DataSource;
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.jdbc.core.JdbcTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BillsetuptaskApplicationTests {
@Autowired
private DataSource dataSource;
@Test
public void testRepository() {
JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource);
int result = jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM BILL_STATEMENTS", Integer.class);
assertEquals(0, result);
}
}