mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-24 15:55:55 +00:00
Merge branch 'DevFactory-release/collection-isempty-1'
This commit is contained in:
@@ -49,7 +49,7 @@ final class DRawSqlColumnsParser {
|
||||
if (split.length > 1) {
|
||||
ArrayList<String> tmp = new ArrayList<String>(split.length);
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if (split[i].trim().length() > 0) {
|
||||
if (!split[i].trim().isEmpty()) {
|
||||
tmp.add(split[i].trim());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public final class Ebean {
|
||||
// look to see if there is a default server defined
|
||||
String defaultName = PrimaryServer.getDefaultServerName();
|
||||
logger.debug("defaultName:" + defaultName);
|
||||
if (defaultName != null && defaultName.trim().length() > 0) {
|
||||
if (defaultName != null && !defaultName.trim().isEmpty()) {
|
||||
defaultServer = getWithCreate(defaultName.trim());
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public final class Ebean {
|
||||
}
|
||||
|
||||
private EbeanServer get(String name) {
|
||||
if (name == null || name.length() == 0) {
|
||||
if (name == null || name.isEmpty()) {
|
||||
return defaultServer;
|
||||
}
|
||||
// non-synchronized read
|
||||
|
||||
@@ -400,6 +400,6 @@ public final class OrderBy<T> implements Serializable {
|
||||
}
|
||||
|
||||
private boolean isEmptyString(String s) {
|
||||
return s == null || s.length() == 0;
|
||||
return s == null || s.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ class PrimaryServer {
|
||||
* Return true if the string is null or empty.
|
||||
*/
|
||||
private static boolean isEmpty(String value) {
|
||||
return value == null || value.trim().length() == 0;
|
||||
return value == null || value.trim().isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ public abstract class AbstractNamingConvention implements NamingConvention {
|
||||
* Checks string is null or empty .
|
||||
*/
|
||||
protected boolean isEmpty(String s) {
|
||||
return s == null || s.trim().length() == 0;
|
||||
return s == null || s.trim().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2460,7 +2460,7 @@ public class ServerConfig {
|
||||
String[] split = classNames.split("[ ,;]");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
String cn = split[i].trim();
|
||||
if (cn.length() > 0 && !"class".equalsIgnoreCase(cn)) {
|
||||
if (!cn.isEmpty() && !"class".equalsIgnoreCase(cn)) {
|
||||
try {
|
||||
classes.add(Class.forName(cn));
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
||||
@@ -146,6 +146,6 @@ public final class TableName {
|
||||
* @return true, if is valid
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return name != null && name.length() > 0;
|
||||
return name != null && !name.isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -492,7 +492,7 @@ public class DatabasePlatform {
|
||||
*/
|
||||
public String convertQuotedIdentifiers(String dbName) {
|
||||
// Ignore null values e.g. schema name or catalog
|
||||
if (dbName != null && dbName.length() > 0) {
|
||||
if (dbName != null && !dbName.isEmpty()) {
|
||||
if (dbName.charAt(0) == BACK_TICK) {
|
||||
if (dbName.charAt(dbName.length() - 1) == BACK_TICK) {
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ public class PathProperties implements FetchPath {
|
||||
String path = entry.getKey();
|
||||
String props = entry.getValue().getPropertiesAsString();
|
||||
|
||||
if (path == null || path.length() == 0) {
|
||||
if (path == null || path.isEmpty()) {
|
||||
query.select(props);
|
||||
} else {
|
||||
query.fetch(path, props);
|
||||
|
||||
@@ -108,7 +108,7 @@ class PathPropertiesParser {
|
||||
|
||||
private void addCurrentProperty() {
|
||||
String w = currentWord();
|
||||
if (w.length() > 0) {
|
||||
if (!w.isEmpty()) {
|
||||
currentPathProps.addProperty(w);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public final class TimeStringParser implements StringParser {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public Object parse(String value) {
|
||||
if (value == null || value.trim().length() == 0) {
|
||||
if (value == null || value.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public class StringHelper {
|
||||
String listDelimiter, String nameValueSeparator) {
|
||||
|
||||
HashMap<String, String> params = new HashMap<String, String>();
|
||||
if ((allNameValuePairs == null) || (allNameValuePairs.length() == 0)) {
|
||||
if ((allNameValuePairs == null) || (allNameValuePairs.isEmpty())) {
|
||||
return params;
|
||||
}
|
||||
// trim off any leading listDelimiter...
|
||||
@@ -155,7 +155,7 @@ public class StringHelper {
|
||||
* Return true if the value is null or an empty string.
|
||||
*/
|
||||
public static boolean isNull(String value) {
|
||||
return value == null || value.trim().length() == 0;
|
||||
return value == null || value.trim().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ public class StringHelper {
|
||||
// there is a key without a value?
|
||||
String key = allNameValuePairs.substring(pos, delimPos);
|
||||
key = key.trim();
|
||||
if (key.length() > 0) {
|
||||
if (!key.isEmpty()) {
|
||||
map.put(key, null);
|
||||
}
|
||||
return getKeyValue(map, delimPos + 1, allNameValuePairs, listDelimiter,
|
||||
@@ -251,7 +251,7 @@ public class StringHelper {
|
||||
if (endPos == -1) {
|
||||
if (startPos <= str.length()) {
|
||||
String lastValue = str.substring(startPos, str.length());
|
||||
if (keepEmpties || lastValue.length() != 0) {
|
||||
if (keepEmpties || !lastValue.isEmpty()) {
|
||||
list.add(lastValue);
|
||||
}
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public class StringHelper {
|
||||
} else {
|
||||
// get the delimited value... add it..
|
||||
String value = str.substring(startPos, endPos);
|
||||
if (keepEmpties || value.length() != 0) {
|
||||
if (keepEmpties || !value.isEmpty()) {
|
||||
list.add(value);
|
||||
}
|
||||
// recursively search as we are not at the end yet...
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ExtraDdlXmlReader {
|
||||
* @param platforms The platforms (comma delimited) this script should run for
|
||||
*/
|
||||
public static boolean matchPlatform(String platformName, String platforms) {
|
||||
if (platforms == null || platforms.trim().length() == 0) {
|
||||
if (platforms == null || platforms.trim().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
String[] names = platforms.split("[,;]");
|
||||
|
||||
@@ -1141,7 +1141,7 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
|
||||
// already assigned (So custom or UUID)
|
||||
return;
|
||||
}
|
||||
if (desc.propertiesId().size() == 0) {
|
||||
if (desc.propertiesId().isEmpty()) {
|
||||
// bean doesn't have an Id property
|
||||
if (desc.isBaseTableType() && desc.getBeanFinder() == null) {
|
||||
// expecting an id property
|
||||
|
||||
@@ -283,7 +283,7 @@ public class DeployBeanDescriptor<T> {
|
||||
docStoreUpdate = docStore.update();
|
||||
docStoreDelete = docStore.delete();
|
||||
String doc = docStore.doc();
|
||||
if (doc.length() > 0) {
|
||||
if (!doc.isEmpty()) {
|
||||
docStorePathProperties = PathProperties.parse(doc);
|
||||
}
|
||||
}
|
||||
@@ -388,7 +388,7 @@ public class DeployBeanDescriptor<T> {
|
||||
public void setCache(Cache cache) {
|
||||
|
||||
String naturalKey = null;
|
||||
if (cache.naturalKey().length() > 0) {
|
||||
if (!cache.naturalKey().isEmpty()) {
|
||||
// find the property and mark as natural key property
|
||||
String propName = cache.naturalKey().trim();
|
||||
DeployBeanProperty beanProperty = getBeanProperty(propName);
|
||||
@@ -835,7 +835,7 @@ public class DeployBeanDescriptor<T> {
|
||||
return null;
|
||||
}
|
||||
String selectClause = sb.toString();
|
||||
if (selectClause.length() == 0) {
|
||||
if (selectClause.isEmpty()) {
|
||||
throw new IllegalStateException("Bean " + getFullName() + " has no properties?");
|
||||
}
|
||||
return selectClause.substring(0, selectClause.length() - 1);
|
||||
|
||||
@@ -386,7 +386,7 @@ public class DeployBeanProperty {
|
||||
* Set a specific DB column definition.
|
||||
*/
|
||||
public void setDbColumnDefn(String dbColumnDefn) {
|
||||
if (dbColumnDefn == null || dbColumnDefn.trim().length() == 0) {
|
||||
if (dbColumnDefn == null || dbColumnDefn.trim().isEmpty()) {
|
||||
this.dbColumnDefn = null;
|
||||
} else {
|
||||
this.dbColumnDefn = InternString.intern(dbColumnDefn);
|
||||
|
||||
+2
-2
@@ -178,7 +178,7 @@ public class DeployBeanPropertyAssocMany<T> extends DeployBeanPropertyAssoc<T> {
|
||||
* Set the default mapKey to use when returning a Map.
|
||||
*/
|
||||
public void setMapKey(String mapKey) {
|
||||
if (mapKey != null && mapKey.length() > 0) {
|
||||
if (mapKey != null && !mapKey.isEmpty()) {
|
||||
this.mapKey = mapKey;
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ public class DeployBeanPropertyAssocMany<T> extends DeployBeanPropertyAssoc<T> {
|
||||
* list, set or map.
|
||||
*/
|
||||
public void setFetchOrderBy(String orderBy) {
|
||||
if (orderBy != null && orderBy.length() > 0) {
|
||||
if (orderBy != null && !orderBy.isEmpty()) {
|
||||
fetchOrderBy = orderBy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class AnnotationBase {
|
||||
* Checks string is null or empty .
|
||||
*/
|
||||
protected boolean isEmpty(String s) {
|
||||
return s == null || s.trim().length() == 0;
|
||||
return s == null || s.trim().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public class DeployInheritInfo {
|
||||
public void setDiscriminatorValue(String value) {
|
||||
if (value != null) {
|
||||
value = value.trim();
|
||||
if (value.length() != 0) {
|
||||
if (!value.isEmpty()) {
|
||||
discriminatorStringValue = value;
|
||||
// convert the value if desired
|
||||
if (discriminatorType == Types.INTEGER) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SqlReservedWords {
|
||||
public static synchronized void addKeyword(String keyword){
|
||||
if (keyword != null){
|
||||
keyword = keyword.trim().toUpperCase();
|
||||
if (keyword.length() > 0){
|
||||
if (!keyword.isEmpty()){
|
||||
keywords.add(keyword);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class StringHelper {
|
||||
String listDelimiter, String nameValueSeparator) {
|
||||
|
||||
HashMap<String, String> params = new HashMap<String, String>();
|
||||
if ((allNameValuePairs == null) || (allNameValuePairs.length() == 0)) {
|
||||
if ((allNameValuePairs == null) || (allNameValuePairs.isEmpty())) {
|
||||
return params;
|
||||
}
|
||||
// trim off any leading listDelimiter...
|
||||
@@ -56,7 +56,7 @@ public class StringHelper {
|
||||
* Return true if the value is null or an empty string.
|
||||
*/
|
||||
public static boolean isNull(String value) {
|
||||
return value == null || value.trim().length() == 0;
|
||||
return value == null || value.trim().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ public class StringHelper {
|
||||
// there is a key without a value?
|
||||
String key = allNameValuePairs.substring(pos, delimPos);
|
||||
key = key.trim();
|
||||
if (key.length() > 0) {
|
||||
if (!key.isEmpty()) {
|
||||
map.put(key, null);
|
||||
}
|
||||
return getKeyValue(map, delimPos + 1, allNameValuePairs, listDelimiter,
|
||||
|
||||
@@ -466,7 +466,7 @@ public class CQueryBuilder {
|
||||
String inheritanceWhere = select.getInheritanceWhereSql();
|
||||
|
||||
boolean hasWhere = false;
|
||||
if (inheritanceWhere.length() > 0) {
|
||||
if (!inheritanceWhere.isEmpty()) {
|
||||
sb.append(" where");
|
||||
sb.append(inheritanceWhere);
|
||||
hasWhere = true;
|
||||
@@ -571,7 +571,7 @@ public class CQueryBuilder {
|
||||
}
|
||||
|
||||
private boolean isEmpty(String s) {
|
||||
return s == null || s.length() == 0;
|
||||
return s == null || s.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class CQueryBuilderRawSql {
|
||||
}
|
||||
|
||||
private boolean isEmpty(String s) {
|
||||
return s == null || s.length() == 0;
|
||||
return s == null || s.isEmpty();
|
||||
}
|
||||
|
||||
private String getOrderBy(CQueryPredicates predicates, RawSql.Sql sql) {
|
||||
|
||||
@@ -295,7 +295,7 @@ public class CQueryPredicates {
|
||||
}
|
||||
|
||||
private boolean isEmpty(String s) {
|
||||
return s == null || s.length() == 0;
|
||||
return s == null || s.isEmpty();
|
||||
}
|
||||
|
||||
private String parse(String expr, DeployParser deployParser) {
|
||||
|
||||
@@ -137,7 +137,7 @@ public class DefaultDbSqlContext implements DbSqlContext {
|
||||
}
|
||||
|
||||
// add on any inheritance where clause
|
||||
if (inheritance != null && inheritance.length() > 0) {
|
||||
if (inheritance != null && !inheritance.isEmpty()) {
|
||||
sb.append(" and ").append(a2).append(".").append(inheritance);
|
||||
}
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ public class SqlTreeBuilder {
|
||||
// This makes sense for transient properties used to
|
||||
// hold sum() count() type values (with SqlSelect)
|
||||
for (String propName : queryProps.getSelectProperties()) {
|
||||
if (propName.length() > 0) {
|
||||
if (!propName.isEmpty()) {
|
||||
addProperty(selectProps, desc, queryProps, propName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1161,7 +1161,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
|
||||
@Override
|
||||
public DefaultOrmQuery<T> order(String orderByClause) {
|
||||
if (orderByClause == null || orderByClause.trim().length() == 0) {
|
||||
if (orderByClause == null || orderByClause.trim().isEmpty()) {
|
||||
this.orderBy = null;
|
||||
} else {
|
||||
this.orderBy = new OrderBy<T>(this, orderByClause);
|
||||
|
||||
@@ -134,7 +134,7 @@ public class OrmQueryDetailParser {
|
||||
}
|
||||
}
|
||||
String whereClause = sb.toString().trim();
|
||||
if (whereClause.length() > 0) {
|
||||
if (!whereClause.isEmpty()) {
|
||||
rawWhereClause = whereClause;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ public class OrmQueryProperties implements Serializable {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void configureBeanQuery(SpiQuery<?> query) {
|
||||
|
||||
if (trimmedProperties != null && trimmedProperties.length() > 0) {
|
||||
if (trimmedProperties != null && !trimmedProperties.isEmpty()) {
|
||||
query.select(trimmedProperties);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ public class OrmQueryPropertiesParser {
|
||||
String temp;
|
||||
for (int i = 0; i < res.length; i++) {
|
||||
temp = res[i].trim();
|
||||
if (temp.length() > 0) {
|
||||
if (!temp.isEmpty()) {
|
||||
if (count > 0) {
|
||||
sb.append(",");
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class TCsvReader<T> implements CsvReader<T> {
|
||||
|
||||
strValue = strValue.trim();
|
||||
|
||||
if (strValue.length() == 0) {
|
||||
if (strValue.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ScalarTypeChar extends ScalarTypeBaseVarchar<Character> {
|
||||
|
||||
public Character read(DataReader dataReader) throws SQLException {
|
||||
String string = dataReader.getString();
|
||||
if (string == null || string.length() == 0) {
|
||||
if (string == null || string.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return string.charAt(0);
|
||||
|
||||
@@ -86,7 +86,7 @@ public class BindParamsParser {
|
||||
|
||||
if (params.isSameBindHash()) {
|
||||
String preparedSql = params.getPreparedSql();
|
||||
if (preparedSql != null && preparedSql.length() > 0) {
|
||||
if (preparedSql != null && !preparedSql.isEmpty()) {
|
||||
// the sql has already been parsed and positionedParameters are set in order
|
||||
return preparedSql;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public final class SortByClauseParser {
|
||||
}
|
||||
|
||||
private Property parseSection(String section) {
|
||||
if (section.length() == 0) {
|
||||
if (section.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
String[] words = section.split(" ");
|
||||
|
||||
+1
-1
@@ -321,7 +321,7 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
* Return the supplied value or default to the bean name lower case.
|
||||
*/
|
||||
protected String derive(BeanType<?> desc, String suppliedValue) {
|
||||
return (suppliedValue != null && suppliedValue.length() > 0) ? suppliedValue : desc.getName().toLowerCase();
|
||||
return (suppliedValue != null && !suppliedValue.isEmpty()) ? suppliedValue : desc.getName().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,6 @@ public class PrimaryServerTest {
|
||||
public void testLoadProperties() throws Exception {
|
||||
|
||||
Properties properties = PrimaryServer.getProperties();
|
||||
assertTrue(properties.size() > 0);
|
||||
assertTrue(!properties.isEmpty());
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,6 @@ public class TestFetchId extends BaseTestCase {
|
||||
List<Object> idList = futureIds.get();
|
||||
Assert.assertTrue("same instance", partial == idList);
|
||||
|
||||
Assert.assertTrue("sz > 0", ids.size() > 0);
|
||||
Assert.assertTrue("sz > 0", !ids.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class TestInheritRef extends BaseTestCase {
|
||||
.setAutoTune(false)
|
||||
.findList();
|
||||
|
||||
Assert.assertTrue(list.size() > 0);
|
||||
Assert.assertTrue(!list.isEmpty());
|
||||
|
||||
Truck foundTruck = null;
|
||||
int found = 0;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TestLazyLoadInCache extends BaseTestCase {
|
||||
.orderBy().asc("id")
|
||||
.findMap();
|
||||
|
||||
assertTrue(map.size() > 0);
|
||||
assertTrue(!map.isEmpty());
|
||||
|
||||
Object id = map.keySet().iterator().next();
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class TestLimitQuery extends BaseTestCase {
|
||||
|
||||
List<Order> list = query.findList();
|
||||
|
||||
Assert.assertTrue("sz > 0", list.size() > 0);
|
||||
Assert.assertTrue("sz > 0", !list.isEmpty());
|
||||
|
||||
String sql = query.getGeneratedSql();
|
||||
boolean hasDetailsJoin = sql.contains("join o_order_detail");
|
||||
|
||||
@@ -76,7 +76,7 @@ public class TestM2MVanilla extends BaseTestCase {
|
||||
Query<MUser> rolesQuery = Ebean.find(MUser.class).where().in("roles", roleList).query();
|
||||
|
||||
List<MUser> userInRolesList = rolesQuery.findList();
|
||||
Assert.assertTrue(userInRolesList.size() > 0);
|
||||
Assert.assertTrue(!userInRolesList.isEmpty());
|
||||
|
||||
List<MUser> list = Ebean.find(MUser.class)
|
||||
.where().in("roles", roleList)
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestManyLazyLoad extends BaseTestCase {
|
||||
awaitL2Cache();
|
||||
|
||||
List<Order> list = Ebean.find(Order.class).order().asc("id").findList();
|
||||
assertTrue(list.size() + " > 0", list.size() > 0);
|
||||
assertTrue(list.size() + " > 0", !list.isEmpty());
|
||||
|
||||
// just use the first one
|
||||
Order order = list.get(0);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class TestOrderByAnnotation extends BaseTestCase {
|
||||
Customer customer = Ebean.find(Customer.class, custTest.getId());
|
||||
List<Order> orders = customer.getOrders();
|
||||
|
||||
Assert.assertTrue(orders.size() > 0);
|
||||
Assert.assertTrue(!orders.isEmpty());
|
||||
|
||||
|
||||
Query<Order> q1 = Ebean.find(Order.class)
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TestReadOnlyPropagation extends BaseTestCase {
|
||||
Assert.assertTrue(!bc.isPopulated());
|
||||
|
||||
bc.size();
|
||||
Assert.assertTrue(bc.size() > 0);
|
||||
Assert.assertTrue(!bc.isEmpty());
|
||||
Assert.assertTrue(bc.isReadOnly());
|
||||
Assert.assertTrue(bc.isPopulated());
|
||||
try {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TestSharedInstancePropagation extends BaseTestCase {
|
||||
bc.size();
|
||||
|
||||
assertTrue(bc.isPopulated());
|
||||
assertTrue(bc.size() > 0);
|
||||
assertTrue(!bc.isEmpty());
|
||||
OrderDetail detail = details.get(0);
|
||||
|
||||
assertTrue(Ebean.getBeanState(detail).isReadOnly());
|
||||
|
||||
@@ -23,7 +23,7 @@ public class TestWhereAnnotation extends BaseTestCase {
|
||||
Customer customer = Ebean.find(Customer.class, custTest.getId());
|
||||
List<Order> orders = customer.getOrders();
|
||||
|
||||
Assert.assertTrue(orders.size() > 0);
|
||||
Assert.assertTrue(!orders.isEmpty());
|
||||
|
||||
Query<Customer> q1 = Ebean.find(Customer.class).setUseCache(false).fetch("orders").where()
|
||||
.idEq(1).query();
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TestBasicLazy extends BaseTestCase {
|
||||
// some contacts
|
||||
Customer c = Ebean.find(Customer.class).setId(1).findUnique();
|
||||
Assert.assertNotNull(c.getContacts());
|
||||
Assert.assertTrue("no contacts on test customer 1", c.getContacts().size() > 0);
|
||||
Assert.assertTrue("no contacts on test customer 1", !c.getContacts().isEmpty());
|
||||
|
||||
// start transaction so we have a "long running" persistence context
|
||||
Transaction tx = Ebean.beginTransaction();
|
||||
@@ -56,7 +56,7 @@ public class TestBasicLazy extends BaseTestCase {
|
||||
List<Order> order = Ebean.find(Order.class).where(Expr.eq("customer.id", 1)).findList();
|
||||
|
||||
Assert.assertNotNull(order);
|
||||
Assert.assertTrue(order.size() > 0);
|
||||
Assert.assertTrue(!order.isEmpty());
|
||||
|
||||
Customer customer = order.get(0).getCustomer();
|
||||
Assert.assertNotNull(customer);
|
||||
@@ -66,7 +66,7 @@ public class TestBasicLazy extends BaseTestCase {
|
||||
List<Contact> contacts = customer.getContacts();
|
||||
|
||||
Assert.assertNotNull(contacts);
|
||||
Assert.assertTrue("contacts not lazily fetched", contacts.size() > 0);
|
||||
Assert.assertTrue("contacts not lazily fetched", !contacts.isEmpty());
|
||||
} finally {
|
||||
tx.commit();
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class TestBasicLazy extends BaseTestCase {
|
||||
MyTestDataSourcePoolListener.SLEEP_AFTER_BORROW = 0;
|
||||
}
|
||||
|
||||
if (exceptions.size() > 0) {
|
||||
if (!exceptions.isEmpty()) {
|
||||
System.err.println("Seen Exceptions:");
|
||||
for (Throwable exception : exceptions) {
|
||||
exception.printStackTrace();
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TestLazyJoin2 extends BaseTestCase {
|
||||
Order o0 = l0.get(0);
|
||||
Customer c0 = o0.getCustomer();
|
||||
List<Contact> contacts = c0.getContacts();
|
||||
Assert.assertTrue(contacts.size() > 0);
|
||||
Assert.assertTrue(!contacts.isEmpty());
|
||||
|
||||
// query 1) find order (status, shipDate)
|
||||
// query 2) find orderDetail (quantity, price) join product (sku, name)
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TestQueryJoin extends BaseTestCase {
|
||||
System.out.println(billingAddress);
|
||||
billingAddress.getLine1();
|
||||
|
||||
Assert.assertTrue(list.size() > 0);
|
||||
Assert.assertTrue(!list.isEmpty());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TestSecondaryQueries extends BaseTestCase {
|
||||
spiQuery.setLogSecondaryQuery(true);
|
||||
|
||||
List<Order> list = query.findList();
|
||||
Assert.assertTrue(list.size() > 0);
|
||||
Assert.assertTrue(!list.isEmpty());
|
||||
for (Order order : list) {
|
||||
order.getCustomer().getStatus();
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class TestQueryCache extends BaseTestCase {
|
||||
BeanCollection<Customer> bc = (BeanCollection<Customer>) list;
|
||||
Assert.assertFalse(bc.isReadOnly());
|
||||
Assert.assertFalse(bc.isEmpty());
|
||||
Assert.assertTrue(list.size() > 0);
|
||||
Assert.assertTrue(!list.isEmpty());
|
||||
Assert.assertTrue(Ebean.getBeanState(list.get(0)).isReadOnly());
|
||||
|
||||
List<Customer> list2 = Ebean.find(Customer.class).setUseQueryCache(true).setReadOnly(true).where()
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TestQueryCacheCountry extends BaseTestCase {
|
||||
.findList();
|
||||
|
||||
assertEquals(1, queryCache.getStatistics(false).getSize());
|
||||
assertTrue(countryList0.size() > 0);
|
||||
assertTrue(!countryList0.isEmpty());
|
||||
|
||||
List<Country> countryList1 = Ebean.find(Country.class)
|
||||
.setUseQueryCache(true)
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TestInheritAbstract extends TestCase {
|
||||
.findList();
|
||||
|
||||
Assert.assertNotNull(list2);
|
||||
Assert.assertTrue(list2.size() > 0);
|
||||
Assert.assertTrue(!list2.isEmpty());
|
||||
|
||||
for (AbstractBar abstractBar : list2) {
|
||||
Foo foo = abstractBar.getFoo();
|
||||
|
||||
@@ -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