@Test public void mixedCriteria() throws Exception { FindReachRequest req = new FindReachRequest(); req.modelID = TEST_MODEL_ID.toString(); req.edaName = " , ,, Albemarle Sound, Altamaha River, "; req.meanQLo = "50"; req.totContributingAreaLo = "100"; req.totContributingAreaHi = "150"; req.reachName = "cr"; req.huc = "030102"; FindReaches action = new FindReaches(); action.setReachRequest(req); action.setPageSize(10); DataTable result = action.run(); assertTrue(result.getRowCount() == 4); assertEquals(0, action.getValidationErrors().length); assertEquals("4915", result.getString(0, result.getColumnByName("FULL_IDENTIFIER"))); assertEquals("4851", result.getString(1, result.getColumnByName("FULL_IDENTIFIER"))); assertEquals("4840", result.getString(2, result.getColumnByName("FULL_IDENTIFIER"))); assertEquals("4850", result.getString(3, result.getColumnByName("FULL_IDENTIFIER"))); }
/** * The contributing area for this reach is different than the total area for this reach, so this * test ensures that we are search on the correct column. * * <p>**Note that the areas in the DEV db (the one being queries for these tests) is different * than the values in the TEST db. * * @throws Exception */ @Test public void searchByHiLowContribAreaWithSingleResultAndEnsureContribAreaNotTotalArea() throws Exception { FindReachRequest req = new FindReachRequest(); req.modelID = TEST_MODEL_ID.toString(); req.totContributingAreaHi = "113285"; req.totContributingAreaLo = "113284"; FindReaches action = new FindReaches(); action.setReachRequest(req); action.setPageSize(50); DataTable result = action.run(); assertTrue(result.getRowCount() == 1); assertEquals(0, action.getValidationErrors().length); assertEquals("9682", result.getString(0, result.getColumnByName("FULL_IDENTIFIER"))); assertEquals("MOBILE R", result.getString(0, result.getColumnByName("REACH_NAME"))); assertEquals("64063.55", result.getString(0, result.getColumnByName("MEANQ"))); assertEquals("113284.268214", result.getString(0, result.getColumnByName("TOT_CONTRIB_AREA"))); assertEquals("03", result.getString(0, result.getColumnByName("HUC2"))); assertEquals("0316", result.getString(0, result.getColumnByName("HUC4"))); assertEquals("031602", result.getString(0, result.getColumnByName("HUC6"))); assertEquals("03160204", result.getString(0, result.getColumnByName("HUC8"))); }
@Test public void searchByHiLowContribAreaWithMultipleResults() throws Exception { FindReachRequest req = new FindReachRequest(); req.modelID = TEST_MODEL_ID.toString(); req.totContributingAreaHi = "100"; req.totContributingAreaLo = "99.5"; FindReaches action = new FindReaches(); action.setReachRequest(req); action.setPageSize(50); DataTable result = action.run(); assertTrue(result.getRowCount() == 15); assertEquals(0, action.getValidationErrors().length); assertEquals("7126", result.getString(0, result.getColumnByName("FULL_IDENTIFIER"))); assertEquals("BIG SANDY CR", result.getString(0, result.getColumnByName("REACH_NAME"))); assertEquals("81.02", result.getString(0, result.getColumnByName("MEANQ"))); assertEquals("99.82", result.getString(0, result.getColumnByName("TOT_CONTRIB_AREA"))); assertEquals("03", result.getString(0, result.getColumnByName("HUC2"))); assertEquals("0307", result.getString(0, result.getColumnByName("HUC4"))); assertEquals("030701", result.getString(0, result.getColumnByName("HUC6"))); assertEquals("03070103", result.getString(0, result.getColumnByName("HUC8"))); }
@Test public void searchByHiLowContribAreaValidationCheck() throws Exception { FindReachRequest req = new FindReachRequest(); req.modelID = TEST_MODEL_ID.toString(); req.totContributingAreaHi = "10"; req.totContributingAreaLo = "11"; FindReaches action = new FindReaches(); action.setReachRequest(req); action.setPageSize(50); DataTable result = action.run(); assertNull(result); assertEquals(1, action.getValidationErrors().length); }