public boolean checkEvents(BundleEvent[] expevents) { boolean res = true; for (int i = 0; i < 20; i++) { try { Thread.sleep(100); } catch (InterruptedException ignore) { } if (events.size() == expevents.length) { break; } } if (events.size() == expevents.length) { for (int i = 0; i < events.size(); i++) { BundleEvent be = (BundleEvent) events.elementAt(i); if (!(be.getBundle().equals(expevents[i].getBundle()) && be.getType() == expevents[i].getType())) { res = false; } } } else { res = false; } if (!res) { out.println("Real events"); for (int i = 0; i < events.size(); i++) { BundleEvent be = (BundleEvent) events.elementAt(i); out.println("Event " + be.getBundle() + ", Type " + be.getType()); } out.println("Expected events"); for (int i = 0; i < expevents.length; i++) { out.println("Event " + expevents[i].getBundle() + ", Type " + expevents[i].getType()); } } return res; }
/** * Enumerate the methods of the Clob interface and get the list of methods present in the * interface * * @param LOB an instance of the Clob interface implementation */ void buildMethodList(Object LOB) throws IllegalAccessException, InvocationTargetException { // If the given method throws the correct exception // set this to true and add it to the boolean valid = true; // create a list of the methods that fail the test Vector<Method> methodList = new Vector<Method>(); // The class whose methods are to be verified Class clazz = Clob.class; // The list of the methods in the class that need to be invoked // and verified Method[] methods = clazz.getMethods(); // Check each of the methods to ensure that // they throw the required exception for (int i = 0; i < methods.length; i++) { if (!checkIfExempted(methods[i])) { valid = checkIfMethodThrowsSQLException(LOB, methods[i]); // add the method to the list if the method does // not throw the required exception if (valid == false) methodList.add(methods[i]); // reset valid valid = true; } } if (!methodList.isEmpty()) { int c = 0; String failureMessage = "The Following methods don't throw " + "required exception - "; for (Method m : methodList) { c = c + 1; if (c == methodList.size() && c != 1) failureMessage += " & "; else if (c != 1) failureMessage += " , "; failureMessage += m.getName(); } fail(failureMessage); } }
public int subCount() { return subs.size(); }