DATAJPA-912 - Fix broken test in RepositoryWithCompositeKeyTests.

Use a page size of 1 to enforce a count query creation. The expected exception is only visible with Hibernate 4.1.x when a count query is issued.

Related pull request: #174.
This commit is contained in:
Mark Paluch
2016-08-04 20:57:47 -07:00
parent 21991ce5c6
commit 9381d6a5a3

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2016 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.
@@ -48,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
* Tests some usage variants of composite keys with spring data jpa.
*
* @author Thomas Darimont
* @author Mark Paluch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SampleConfig.class)
@@ -114,6 +115,7 @@ public class RepositoryWithCompositeKeyTests {
/**
* @see DATAJPA-472
* @see DATAJPA-912
*/
@Test
public void shouldSupportFindAllWithPageableAndEntityWithIdClass() throws Exception {
@@ -133,7 +135,7 @@ public class RepositoryWithCompositeKeyTests {
emp.setDepartment(dep);
emp = employeeRepositoryWithIdClass.save(emp);
Page<IdClassExampleEmployee> page = employeeRepositoryWithIdClass.findAll(new PageRequest(0, 10));
Page<IdClassExampleEmployee> page = employeeRepositoryWithIdClass.findAll(new PageRequest(0, 1));
assertThat(page, is(notNullValue()));
assertThat(page.getTotalElements(), is(1L));