【发布时间】:2019-03-13 07:50:47
【问题描述】:
在 Windows (+ Maven) 上,我对 é 的 Métro 字有疑问。我的 sql 文件以 UTF-8 编码。我在 Unix 服务器上确实有这个问题。
我的 Maven 错误:
expected:<M[é]tro Ligne 6, station...> but was:<M[é]tro Ligne 6, station...>
我的 JUnit 代码:
@RunWith(SpringRunner.class)
@DataJpaTest
@ActiveProfiles("test")
public class MyRepositoryTest {
@Autowired
private MyRepository myRepository;
@Test
@Sql("/data/myRepositoryTest.sql")
public void testFindById() {
Optional<My> my= myRepository.findById(99999);
assertTrue(my.isPresent());
assertEquals("Métro Ligne 6, station Bel-Air", my.get().getItinerary());
}
}
我的 sql 文件:
INSERT INTO MY(ID, NAME, CODE, ITINERARY)
VALUES (99999, 'foo', 'abc', 'Métro Ligne 6, station Bel-Air');
【问题讨论】:
-
什么是数据库类型?你在哪一行得到错误?
标签: java maven jpa testing junit