mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Fixing squid:S1155 - Collection.isEmpty() should be used to test for emptiness
This commit is contained in:
@@ -24,7 +24,7 @@ public class TestLimitQuery extends BaseTestCase {
|
||||
.findList();
|
||||
|
||||
// should at least find the "Cust NoAddress" customer
|
||||
Assert.assertTrue(customers.size() > 0);
|
||||
Assert.assertTrue(!customers.isEmpty());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class TestQueryFetchManyTwoDeep extends BaseTestCase {
|
||||
spiQuery.setLogSecondaryQuery(true);
|
||||
|
||||
List<Customer> list = query.findList();
|
||||
Assert.assertTrue("has rows", list.size() > 0);
|
||||
Assert.assertTrue("has rows", !list.isEmpty());
|
||||
Assert.assertTrue(query.getGeneratedSql().contains("from o_customer t0 "));
|
||||
Assert.assertTrue(query.getGeneratedSql().contains("left outer join o_order t1 on t1.kcustomer_id = t0.id"));
|
||||
Assert.assertTrue(query.getGeneratedSql().contains("left outer join o_customer t2 on t2.id = t1.kcustomer_id"));
|
||||
@@ -71,7 +71,7 @@ public class TestQueryFetchManyTwoDeep extends BaseTestCase {
|
||||
.fetch("order.details");
|
||||
|
||||
List<OrderShipment> shipList = shipQuery.findList();
|
||||
Assert.assertTrue("has rows", shipList.size() > 0);
|
||||
Assert.assertTrue("has rows", !shipList.isEmpty());
|
||||
|
||||
String generatedSql = shipQuery.getGeneratedSql();
|
||||
|
||||
@@ -112,7 +112,7 @@ public class TestQueryFetchManyTwoDeep extends BaseTestCase {
|
||||
.fetch("customer.orders");
|
||||
|
||||
List<Contact> shipList = query.findList();
|
||||
Assert.assertTrue("has rows", shipList.size() > 0);
|
||||
Assert.assertTrue("has rows", !shipList.isEmpty());
|
||||
|
||||
String generatedSql = query.getGeneratedSql();
|
||||
|
||||
@@ -144,7 +144,7 @@ public class TestQueryFetchManyTwoDeep extends BaseTestCase {
|
||||
.query();
|
||||
|
||||
List<Contact> list = query.findList();
|
||||
Assert.assertTrue("has rows", list.size() > 0);
|
||||
Assert.assertTrue("has rows", !list.isEmpty());
|
||||
|
||||
String generatedSql = query.getGeneratedSql();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestQueryMultiManyOrder extends BaseTestCase {
|
||||
List<Order> list = q.findList();
|
||||
String sql = q.getGeneratedSql();
|
||||
|
||||
Assert.assertTrue(list.size() > 0);
|
||||
Assert.assertTrue(!list.isEmpty());
|
||||
Assert.assertTrue(sql.contains("join o_customer "));
|
||||
|
||||
Assert.assertFalse(sql.contains("left outer join contact "));
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TestQueryPlanCacheRowCount extends BaseTestCase {
|
||||
Assert.assertEquals(rc0, list1.size());
|
||||
|
||||
int idGt = 5;
|
||||
if (ids1.size() > 0) {
|
||||
if (!ids1.isEmpty()) {
|
||||
Object id = ids.get(0);
|
||||
idGt = Integer.valueOf("" + id);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TestQueryJoinManyNonRoot extends BaseTestCase {
|
||||
List<Order> list = q.findList();
|
||||
String sql = q.getGeneratedSql();
|
||||
|
||||
assertTrue(list.size() > 0);
|
||||
assertTrue(!list.isEmpty());
|
||||
assertTrue(sql.contains("join o_customer t1 on t1.id "));
|
||||
assertTrue(sql.contains("left outer join contact t2 on"));
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TestQueryJoinManyNonRoot extends BaseTestCase {
|
||||
List<Order> list = q.findList();
|
||||
String sql = q.getGeneratedSql();
|
||||
|
||||
assertTrue(list.size() > 0);
|
||||
assertTrue(!list.isEmpty());
|
||||
assertTrue(sql.contains("join o_customer t1 on t1.id "));
|
||||
assertTrue(sql.contains("left outer join o_order_detail "));
|
||||
assertTrue(sql.contains("left outer join o_product "));
|
||||
@@ -105,7 +105,7 @@ public class TestQueryJoinManyNonRoot extends BaseTestCase {
|
||||
order.getCustomer().getContacts().size();
|
||||
}
|
||||
|
||||
assertTrue(list.size() > 0);
|
||||
assertTrue(!list.isEmpty());
|
||||
assertTrue(sql.contains("join o_customer t1 on t1.id "));
|
||||
assertTrue(sql.contains("left outer join contact "));
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TestQueryJoinQueryNonRoot extends BaseTestCase {
|
||||
.where().lt("id", 3).findList();
|
||||
|
||||
Assert.assertNotNull(list);
|
||||
Assert.assertTrue(list.size() > 0);
|
||||
Assert.assertTrue(!list.isEmpty());
|
||||
|
||||
for (Order order : list) {
|
||||
List<Contact> contacts = order.getCustomer().getContacts();
|
||||
|
||||
Reference in New Issue
Block a user