Package org.jtester.exception

Examples of org.jtester.exception.JTesterException


      statement = connection.createStatement();
      resultSet = statement.executeQuery(sql);
      return resultSet.next();

    } catch (Throwable e) {
      throw new JTesterException("Error while executing statement: " + sql, e);
    } finally {
      closeQuietly(connection, statement, resultSet);
    }
  }
View Full Code Here


      throw new RuntimeException("reflector invoke ,the argument[method] can't be null.");
    }
    try {
      return (T) invokeMethod(target, method, arguments);
    } catch (Exception e) {
      throw new JTesterException("Unable to invoke method[" + method.getName() + "].", e);
    }
  }
View Full Code Here

   */
  public static <T> T invokeMethodUnThrow(Object target, String methodName, Object... paras) {
    try {
      return (T) invokeMethod(target, methodName, paras);
    } catch (Exception e) {
      throw new JTesterException("Unable to invoke method[" + methodName + "].", e);
    }
  }
View Full Code Here

    for (String classname : clazzes) {
      Class clazz = null;
      try {
        clazz = Class.forName(classname);
      } catch (ClassNotFoundException e) {
        throw new JTesterException(e);
      }
      Method[] methods = clazz.getMethods();
      for (Method method : methods) {
        if (method.getName().indexOf(methodname) == 0 || method.getName().indexOf("test_" + methodname) == 0) {
          testmethods.add(classname + "." + method.getName());
View Full Code Here

  public static List<String> findTestMethod(String classname, String methodname) {
    try {
      Class claz = Class.forName(classname);
      return MethodFinder.findTestMethod(claz, methodname);
    } catch (ClassNotFoundException e) {
      throw new JTesterException(e);
    }
  }
View Full Code Here

   *            The instance to add to loaded properties to, not null
   */
  private void loadDefaultConfiguration(Properties properties) {
    Properties defaultProperties = propertiesReader.loadPropertiesFileFromClasspath(DEFAULT_PROPERTIES_FILE_NAME);
    if (defaultProperties == null) {
      throw new JTesterException("Configuration file: " + DEFAULT_PROPERTIES_FILE_NAME
          + " not found in classpath.");
    }
    properties.putAll(defaultProperties);
  }
View Full Code Here

      Object value = properties.get(key);
      try {
        String expandedValue = StrSubstitutor.replace(value, properties);
        properties.put(key, expandedValue);
      } catch (Throwable e) {
        throw new JTesterException(
            "Unable to load unitils configuration. Could not expand property value for key: " + key
                + ", value " + value, e);
      }
    }
View Full Code Here

          + PROPKEY_MODULE_SUFFIX_CLASS_NAME);
      try {
        // create module instance
        Object module = createInstanceOfType(className);
        if (!(module instanceof Module)) {
          throw new JTesterException("Unable to load core. Module class is not of type JTesterModule: "
              + className);
        }
        ((Module) module).init();// initialize module
        modules.add((Module) module);
      } catch (Throwable t) {
        throw new JTesterException("An exception occured during the loading of core module " + moduleName
            + " with module class name " + className, t);
      }
    }
    ModulesManager.initManager(modules);
    return modules;
View Full Code Here

      if (defaultValueAsString != null) {
        return defaultValueAsString;
      }
    }
    // nothing found, raise exception
    throw new JTesterException("Could not replace default value. No default value found for annotation: "
        + annotation + ", property " + annotationProperty + ", defaultValues: " + allDefaultValues);
  }
View Full Code Here

   * @return the module, not null
   */
  public static <T extends Module> T getModuleInstance(Class<T> type) {
    List<T> modulesOfType = getModulesOfType(type);
    if (modulesOfType.size() > 1) {
      throw new JTesterException("More than one module found of type " + type.getName());
    }
    if (modulesOfType.size() < 1) {
      throw new JTesterException("No module found of type " + type.getName());
    }
    return modulesOfType.get(0);
  }
View Full Code Here

TOP

Related Classes of org.jtester.exception.JTesterException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.