Package org.testng

Examples of org.testng.TestNGException


        StringBuffer sb = new StringBuffer();
        sb.append("The following methods have cyclic dependencies:\n");
        for (T m : cycle) {
          sb.append(m).append("\n");
        }
        throw new TestNGException(sb.toString());
      }
      else {
        m_strictlySortedNodes.add((T) node.getObject());
        removeFromNodes(nodes2, node);
      }
View Full Code Here


      T instance = clazz.newInstance();

      return instance;
    }
    catch(IllegalAccessException iae) {
      throw new TestNGException("Class " + clazz.getName()
          + " does not have a no-args constructor", iae);
    }
    catch(InstantiationException ie) {
      throw new TestNGException("Cannot instantiate class " + clazz.getName(), ie);
    }
    catch(ExceptionInInitializerError eiierr) {
      throw new TestNGException("An exception occurred in static initialization of class "
          + clazz.getName(), eiierr);
    }
    catch(SecurityException se) {
      throw new TestNGException(se);
    }
  }
View Full Code Here

    for (Method method : cls.getMethods()) {
      IAnnotation f = finder.findAnnotation(method, IFactoryAnnotation.class);

      if (null != f) {
        if (null != result) {
          throw new TestNGException(cls.getName() + ":  only one @Factory method allowed");
        }
        result = method;
      }
    }
View Full Code Here

      tr.setTestResultNotifier(runner);
     
      return tr;
    }
    catch(Exception ex) {
      throw new TestNGException("Cannot create JUnit runner " + JUNIT_TESTRUNNER, ex);
    }
  }
View Full Code Here

    try {
      Class<?> cls = Class.forName(selector.getClassName());
      return (IMethodSelector) cls.newInstance();
    }
    catch(Exception ex) {
      throw new TestNGException("Couldn't find method selector : " + selector.getClassName(), ex);
    }
  }
View Full Code Here

    catch (NoSuchMethodException ex) {
      result = ClassHelper.tryOtherConstructor(declaringClass);
    }
    catch (Throwable cause) {
      // Something else went wrong when running the constructor
      throw new TestNGException("An error occurred while instantiating class "
          + declaringClass.getName() + ": " + cause.getMessage(), cause);
    }
 
    return result;
  }
View Full Code Here

      if (null != annotation) {
        String[] parameters = annotation.getValue();
        Class<?>[] parameterTypes = result.getParameterTypes();
        if (parameters.length != parameterTypes.length) {
          throw new TestNGException("Parameter count mismatch:  " + result + "\naccepts "
                                    + parameterTypes.length
                                    + " parameters but the @Test annotation declares "
                                    + parameters.length);
        }
        else {
View Full Code Here

        message = e.getCause().getMessage();
      }
      String error = "Could not create an instance of class " + declaringClass
      + ((message != null) ? (": " + message) : "")
        + ".\nPlease make sure it has a constructor that accepts either a String or no parameter.";
      throw new TestNGException(error);
    }
 
    return result;
  }
View Full Code Here

      }
      m_slaveAdpter.init(properties);
    }
    catch( Exception e)
    {
      throw new TestNGException( "Fail to initialize slave mode", e);
    }
  }
View Full Code Here

      {
        result = maybeCreateNewConfigurationTag(cls, a, annotationClass);
      }

      else {
        throw new TestNGException("Unknown annotation requested:" + annotationClass);
      }
    }

    return result;
  }
View Full Code Here

TOP

Related Classes of org.testng.TestNGException

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.