public void findMatching() throws Exception { List<Integer> list = DatabaseUtil.getNumBArray( "select numb from array3 where (numb = numb)", nuodbConnection, pstmt); Assert.assertTrue(list.size() >= 1, "The list is empty"); Integer[] actarr = list.toArray(new Integer[list.size()]); Integer[] exparr = {1, 3, 5, 7, 8}; Assert.assertEqualsNoOrder(actarr, exparr); }
public void concatNumbers() throws Exception { List<Integer> list = DatabaseUtil.getUnion( "select numa from array2 union select numb from array3", nuodbConnection, pstmt); Assert.assertTrue(list.size() >= 1, "The list is empty"); Integer[] actarr = list.toArray(new Integer[list.size()]); Integer exparr[] = {0, 2, 4, 5, 6, 8, 9, 1, 3, 5, 7, 8}; Assert.assertEqualsNoOrder(actarr, exparr); }
public void findMismatching() throws Exception { List<String> list1 = DatabaseUtil.getWordsNumArray("select * from array", nuodbConnection, pstmt); Assert.assertTrue(list1.size() >= 1, "The list is empty"); String[] wordsA = list1.toArray(new String[list1.size()]); String[] expwords = {"aPPLE", "AbAcUs", "bRaNcH", "BlUeBeRrY", "ClOvEr"}; Assert.assertNotNull(wordsA, "Empty array"); boolean b = Arrays.equals(wordsA, expwords); Assert.assertFalse(b, "Two array is matched"); }
public void concatProductAndCustomerDetails() throws Exception { List<String> actList = DatabaseUtil.getUnionNames( "select pname from products union select companyname from customers", nuodbConnection, pstmt); Assert.assertTrue(actList.size() >= 1, "The actual list is empty"); List<String> expList = new ArrayList<String>(); expList.add("Alice Mutton"); expList.add("Chef Anton"); expList.add("Gorgonzola"); expList.add("Perth Pasties"); expList.add("Outback Lager"); expList.add("Alfreds Futterkiste"); expList.add("Ana Trujillo"); expList.add("Around the Horn"); expList.add("Berglunds snabb"); expList.add("Du monde"); Collections.sort(expList); Collections.sort(actList); Assert.assertEquals(actList, expList, "Names of all customers and products are mismatching"); }