IDEMPIERE-4292 QueryTest.testOnlySelection fail on fresh db (#62)
Fix test failure on fresh db.
This commit is contained in:
parent
fb3e730ad6
commit
4487904bde
|
@ -36,6 +36,8 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.adempiere.exceptions.DBException;
|
import org.adempiere.exceptions.DBException;
|
||||||
|
import org.compiere.model.MPInstance;
|
||||||
|
import org.compiere.model.MProcess;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.POResultSet;
|
import org.compiere.model.POResultSet;
|
||||||
import org.compiere.model.Query;
|
import org.compiere.model.Query;
|
||||||
|
@ -294,11 +296,19 @@ public class QueryTest extends AbstractTestCase {
|
||||||
assertThrows(DBException.class, () -> {
|
assertThrows(DBException.class, () -> {
|
||||||
query.aggregate(null, Query.AGGREGATE_SUM);
|
query.aggregate(null, Query.AGGREGATE_SUM);
|
||||||
}, "No Expression defined");
|
}, "No Expression defined");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnlySelection() throws Exception
|
public void testOnlySelection() throws Exception
|
||||||
{
|
{
|
||||||
|
//make sure ad_pinstance is not empty
|
||||||
|
int count = DB.getSQLValueEx(null, "SELECT Count(AD_PInstance_ID) FROM AD_PInstance");
|
||||||
|
if (count == 0) {
|
||||||
|
//Generate Shipments (manual)
|
||||||
|
new MPInstance(MProcess.get(Env.getCtx(), 199), 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Get one AD_PInstance_ID
|
// Get one AD_PInstance_ID
|
||||||
int AD_PInstance_ID = DB.getSQLValueEx(null, "SELECT MAX(AD_PInstance_ID) FROM AD_PInstance");
|
int AD_PInstance_ID = DB.getSQLValueEx(null, "SELECT MAX(AD_PInstance_ID) FROM AD_PInstance");
|
||||||
assertTrue(AD_PInstance_ID > 0);
|
assertTrue(AD_PInstance_ID > 0);
|
||||||
|
|
Loading…
Reference in New Issue