Package org.testng

Examples of org.testng.TestNGException


    for (Method m : ClassHelper.getAvailableMethods(cls)) {
      IDataProviderAnnotation dp = (IDataProviderAnnotation)
          finder.findAnnotation(m, IDataProviderAnnotation.class);
      if (null != dp && (name.equals(dp.getName()) || name.equals(m.getName()))) {
        if (shouldBeStatic && (m.getModifiers() & Modifier.STATIC) == 0) {
          throw new TestNGException("DataProvider should be static: " + m);
        }
       
        return new DataProviderHolder(dp, m);
      }
    }
View Full Code Here


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

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

    return result;
  }
View Full Code Here

    assertThat((Integer) result, is(2));

    env.clearImports();
    try {
      env.run(snippet);
      throw new TestNGException("A RuntimeException should have been raised");
    } catch (RuntimeException ignored) {
    }
  }
View Full Code Here

  @Test
  public void check_source_present_with_compilation_error() {
    EvaluationEnvironment env = new EvaluationEnvironment();
    try {
      env.def("boom");
      throw new TestNGException("A GoloCompilationException should have been raised");
    } catch (GoloCompilationException e) {
      assertThat(e.getSourceCode(), notNullValue());
      assertThat(e.getSourceCode(), both(containsString("boom")).and(containsString("module anonymous")));
    }
  }
View Full Code Here

        } catch (Exception e) {
            try {
                BMUnitConfigState.resetConfigurationState(javaMethod);
            } catch(Exception e1) {
            }
            throw new TestNGException(e);
        }
    }
View Full Code Here

            try {
                BMUnitConfigState.resetConfigurationState(javaMethod);
            } catch(Exception e1) {
            }
        } catch (Exception e) {
            throw new TestNGException(e);
        }
    }
View Full Code Here

        classSingleScriptAnnotation = testKlazz.getAnnotation(BMScript.class);
        classMultiScriptAnnotation = testKlazz.getAnnotation(BMScripts.class);
        classSingleRuleAnnotation = testKlazz.getAnnotation(BMRule.class);
        classMultiRuleAnnotation = testKlazz.getAnnotation(BMRules.class);
        if (classMultiRuleAnnotation != null && classSingleRuleAnnotation != null) {
            throw new TestNGException("Use either BMRule or BMRules annotation but not both");
        }
        if (classMultiScriptAnnotation != null && classSingleScriptAnnotation != null) {
            throw new TestNGException("Use either BMScript or BMScripts annotation but not both");
        }
        // install the config before doing anything else
        BMUnitConfigState.pushConfigurationState(classConfigAnnotation, testKlazz);
        // we load scripts before inline rules
        if (classSingleScriptAnnotation != null) {
View Full Code Here

        BMScript methodSingleScriptAnnotation = method.getAnnotation(BMScript.class);
        BMScripts methodMultiScriptAnnotation = method.getAnnotation(BMScripts.class);
        BMRule methodSingleRuleAnnotation = method.getAnnotation(BMRule.class);
        BMRules methodMultiRuleAnnotation = method.getAnnotation(BMRules.class);
        if (methodMultiRuleAnnotation != null && methodSingleRuleAnnotation != null) {
            throw new TestNGException("Use either BMRule or BMRules annotation but not both");
        }
        if (methodMultiScriptAnnotation != null && methodSingleScriptAnnotation != null) {
            throw new TestNGException("Use either BMScript or BMScripts annotation but not both");
        }
        Class<?> testKlazz = method.getDeclaringClass();
        // load the config before doing anything else
        BMUnitConfigState.pushConfigurationState(methodConfigAnnotation, method);
        // we load scripts before inline rules
View Full Code Here

            } catch (Exception e) {
                try {
                    BMUnitConfigState.resetConfigurationState(currentClazz);
                } catch (Exception e1) {
                }
                throw new TestNGException(e);
            }
        }
        currentClazz = newClazz;
        if (newClazz != null) {
            try {
                bmngBeforeClass(newClazz);
            } catch (Exception e) {
                try {
                    BMUnitConfigState.resetConfigurationState(newClazz);
                } catch (Exception e1) {
                }
                throw new TestNGException(e);
            }
        }
    }
View Full Code Here

        cause= fcerr;
      }
    }

    if(null == spf) {
      throw new TestNGException("Cannot initialize a SAXParserFactory\n" + errorLog.toString(), cause);
    }

    return spf;
  }
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.