@Test public void getOrderByPredicate() { final String column = "column"; final OrderByColumn descending = new OrderByColumn(column, true); final OrderByColumn ascending = new OrderByColumn(column, false); final OrderByColumn defaultOrder = new OrderByColumn(null, true); assertEquals(column + " DESC", descending.getOrderByPredicate()); assertEquals(column + " ASC", ascending.getOrderByPredicate()); assertNull(defaultOrder.getOrderByPredicate()); assertEquals(descending.toString(), descending.getOrderByPredicate()); assertEquals(ascending.toString(), ascending.getOrderByPredicate()); assertEquals(defaultOrder.toString(), defaultOrder.getOrderByPredicate()); }
@Nullable @Override public final String getOrderByPredicate() { if (!TextUtils.isEmpty(mSortByColumn)) { return mSortByColumn + ((mIsDescending) ? " DESC" : " ASC"); } else { return null; } }
OrderByColumn implements OrderBy { @Nullable @Override public final String getOrderByPredicate() { if (!TextUtils.isEmpty(mSortByColumn)) { return mSortByColumn + ((mIsDescending) ? " DESC" : " ASC"); } else { return null; } } }
OrderByColumn implements OrderBy { @Nullable @Override public final String getOrderByPredicate() { if (!TextUtils.isEmpty(mSortByColumn)) { return mSortByColumn + ((mIsDescending) ? " DESC" : " ASC"); } else { return null; } } OrderByColumn(@Nullable String sortByColumn, boolean isDescending); }
OrderByColumn implements OrderBy { @Nullable @Override public final String getOrderByPredicate() { if (!TextUtils.isEmpty(mSortByColumn)) { return mSortByColumn + ((mIsDescending) ? " DESC" : " ASC"); } else { return null; } } OrderByColumn(@Nullable String sortByColumn, boolean isDescending); @Nullable @Override String getOrderByColumn(); @Nullable @Override final String getOrderByPredicate(); @Override @Nullable String toString(); }
OrderByColumn implements OrderBy { @Nullable @Override public final String getOrderByPredicate() { if (!TextUtils.isEmpty(mSortByColumn)) { return mSortByColumn + ((mIsDescending) ? " DESC" : " ASC"); } else { return null; } } OrderByColumn(@Nullable String sortByColumn, boolean isDescending); @Nullable @Override String getOrderByColumn(); @Nullable @Override final String getOrderByPredicate(); @Override @Nullable String toString();  }