Added count queries
This commit is contained in:
parent
0900935000
commit
2fff4d24c5
|
@ -22,25 +22,30 @@ public class CountQueryIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenValidData_whenSimpleSelect_thenSucceed() {
|
public void givenValidData_whenSimpleSelect_thenSucceed() {
|
||||||
int count = dsl.select().from(AUTHOR).execute();
|
int count = dsl.select().from(AUTHOR)
|
||||||
|
.execute();
|
||||||
Assert.assertEquals(3, count);
|
Assert.assertEquals(3, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenValidData_whenSelectCount_thenSucceed() {
|
public void givenValidData_whenSelectCount_thenSucceed() {
|
||||||
int count = dsl.selectCount().from(AUTHOR).fetchOne(0, int.class);
|
int count = dsl.selectCount().from(AUTHOR)
|
||||||
|
.where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"))
|
||||||
|
.fetchOne(0, int.class);
|
||||||
Assert.assertEquals(3, count);
|
Assert.assertEquals(3, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenValidData_whenCount_thenSucceed() {
|
public void givenValidData_whenCount_thenSucceed() {
|
||||||
int count = dsl.select(DSL.count()).from(AUTHOR).fetchOne(0, int.class);
|
int count = dsl.select(DSL.count()).from(AUTHOR)
|
||||||
Assert.assertEquals(3, count);
|
.fetchOne(0, int.class);
|
||||||
|
Assert.assertEquals(1, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenValidData_whenFetchCount_thenSucceed() {
|
public void givenValidData_whenFetchCount_thenSucceed() {
|
||||||
int count = dsl.fetchCount(DSL.selectFrom(AUTHOR));
|
int count = dsl.fetchCount(DSL.selectFrom(AUTHOR)
|
||||||
Assert.assertEquals(3, count);
|
.where(AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan")));
|
||||||
|
Assert.assertEquals(1, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue