@Override public boolean isDefault(String s) { return Utils.isStringEmpty(s); } };
public static String defaultIfStringEmpty(String s, String defaultValue) { return isStringEmpty(s) ? defaultValue : s; }
public static boolean isStringNotEmpty(String s) { return !isStringEmpty(s); }
public static String defaultIfStringEmpty(String s, String defaultValue) { return isStringEmpty(s) ? defaultValue : s; }
public static boolean isStringNotEmpty(String s) { return !isStringEmpty(s); }
public static String toString(Object object, Class<?> objectClass) { if(null == object) { return "null"; } final String toString= object.toString(); if(isStringEmpty(toString)) { return "\"\""; } else if (String.class.equals(objectClass)) { return "\"" + toString + '\"'; } else { return toString; } }
public static String toString(Object object, Class<?> objectClass) { if (null == object) { return "null"; } final String toString = object.toString(); if (isStringEmpty(toString)) { return "\"\""; } else if (String.class.equals(objectClass)) { return "\"" + toString + '\"'; } else { return toString; } }
protected void validateOptions() throws BuildException { int suiteCount = getSuiteFileNames().size(); if (suiteCount == 0 && m_classFilesets.size() == 0 && Utils.isStringEmpty(m_methods) && ((null == m_testjar) || !m_testjar.isFile())) { throw new BuildException("No suites, classes, methods or jar file was specified."); } if((null != m_includedGroups) && (m_classFilesets.size() == 0 && suiteCount == 0)) { throw new BuildException("No class filesets or xml file sets specified while using groups"); } if(m_onHaltTarget != null) { if(!getProject().getTargets().containsKey(m_onHaltTarget)) { throw new BuildException("Target " + m_onHaltTarget + " not found in this project"); } } }
if (!Utils.isStringEmpty(description)) { msg.append("\n"); for (int i = 0; i < status.length() + 2; i++) { if (!Utils.isStringEmpty(stackTrace)) { msg.append("\n").append(stackTrace);
protected void validateOptions() throws BuildException { int suiteCount = getSuiteFileNames().size(); if (suiteCount == 0 && m_classFilesets.size() == 0 && Utils.isStringEmpty(m_methods) && ((null == m_testjar) || !m_testjar.isFile())) { throw new BuildException("No suites, classes, methods or jar file was specified."); } if ((null != m_includedGroups) && (m_classFilesets.size() == 0 && suiteCount == 0)) { throw new BuildException("No class filesets or xml file sets specified while using groups"); } if (m_onHaltTarget != null) { if (!getProject().getTargets().containsKey(m_onHaltTarget)) { throw new BuildException("Target " + m_onHaltTarget + " not found in this project"); } } }
public static ReporterConfig deserialize(String inputString) { if (Utils.isStringEmpty(inputString)) { return null; } ReporterConfig reporterConfig = new ReporterConfig(); int clsNameEndIndex = inputString.indexOf(':'); if (clsNameEndIndex == -1) { reporterConfig.setClassName(inputString); } else { reporterConfig.setClassName(inputString.substring(0, clsNameEndIndex)); String propString = inputString.substring(clsNameEndIndex + 1, inputString.length()); String[] props = propString.split(","); for (String prop : props) { String[] propNameAndVal = prop.split("="); if (propNameAndVal.length == 2) { reporterConfig.addProperty(new Property(propNameAndVal[0], propNameAndVal[1])); } } } return reporterConfig; }
String in = m_currentInclude.invocationNumbers; XmlInclude include; if (!Utils.isStringEmpty(in)) { include = new XmlInclude(name, stringToList(in), m_currentIncludeIndex++); } else {
public static ReporterConfig deserialize(String inputString) { if (Utils.isStringEmpty(inputString)) { return null; } ReporterConfig reporterConfig = new ReporterConfig(); int clsNameEndIndex = inputString.indexOf(':'); if (clsNameEndIndex == -1) { reporterConfig.setClassName(inputString); } else { reporterConfig.setClassName(inputString.substring(0, clsNameEndIndex)); String propString = inputString.substring(clsNameEndIndex + 1, inputString.length()); String[] props = propString.split(","); for (String prop : props) { String[] propNameAndVal = prop.split("="); if (propNameAndVal.length == 2) { reporterConfig.addProperty(new Property(propNameAndVal[0], propNameAndVal[1])); } } } return reporterConfig; }
return; if (isStringEmpty(m_jarPath)) { return;
String in = m_currentInclude.invocationNumbers; XmlInclude include; if (!Utils.isStringEmpty(in)) { include = new XmlInclude(name, stringToList(in), m_currentIncludeIndex++); } else {
private static IDataProviderMethod findDataProvider(Object instance, ITestClass clazz, ConstructorOrMethod m, IAnnotationFinder finder, ITestContext context) { IDataProviderMethod result = null; IDataProvidable dp = findDataProviderInfo(clazz, m, finder); if (dp != null) { String dataProviderName = dp.getDataProvider(); Class dataProviderClass = dp.getDataProviderClass(); if (! Utils.isStringEmpty(dataProviderName)) { result = findDataProvider(instance, clazz, finder, dataProviderName, dataProviderClass, context); if(null == result) { throw new TestNGException("Method " + m + " requires a @DataProvider named : " + dataProviderName + (dataProviderClass != null ? " in class " + dataProviderClass.getName() : "") ); } } } return result; }
if (!Utils.isStringEmpty(description)) { attributes.setProperty(XMLReporterConfig.ATTR_DESC, description); if (!Utils.isStringEmpty(groupNamesStr)) { attributes.setProperty(XMLReporterConfig.ATTR_GROUPS, groupNamesStr); if (!Utils.isStringEmpty(dependsOnStr)) { attributes.setProperty(XMLReporterConfig.ATTR_DEPENDS_ON_METHODS, dependsOnStr); if (!Utils.isStringEmpty(dependsOnStr)) { attributes.setProperty(XMLReporterConfig.ATTR_DEPENDS_ON_GROUPS, dependsOnStr);
private void addTestResultException(XMLStringBuffer xmlBuffer, ITestResult testResult) { Throwable exception = testResult.getThrowable(); if (exception != null) { Properties exceptionAttrs = new Properties(); exceptionAttrs.setProperty(XMLReporterConfig.ATTR_CLASS, exception.getClass().getName()); xmlBuffer.push(XMLReporterConfig.TAG_EXCEPTION, exceptionAttrs); if (!Utils.isStringEmpty(exception.getMessage())) { xmlBuffer.push(XMLReporterConfig.TAG_MESSAGE); xmlBuffer.addCDATA(exception.getMessage()); xmlBuffer.pop(); } XMLReporterConfig.StackTraceLevels level = calculateStackTraceLevels(testResult); switch (level) { case SHORT: xmlBuffer.push(XMLReporterConfig.TAG_SHORT_STACKTRACE); xmlBuffer.addCDATA(Utils.shortStackTrace(exception, false)); xmlBuffer.pop(); break; case FULL: xmlBuffer.push(XMLReporterConfig.TAG_FULL_STACKTRACE); xmlBuffer.addCDATA(Utils.longStackTrace(exception, false)); xmlBuffer.pop(); break; default: //everything else is ignored for now. } xmlBuffer.pop(); } }
private static IDataProviderMethod findDataProvider( Object instance, ITestClass clazz, ConstructorOrMethod m, IAnnotationFinder finder, ITestContext context) { IDataProviderMethod result = null; IDataProvidable dp = findDataProviderInfo(clazz, m, finder); if (dp != null) { String dataProviderName = dp.getDataProvider(); Class dataProviderClass = dp.getDataProviderClass(); if (!Utils.isStringEmpty(dataProviderName)) { result = findDataProvider(instance, clazz, finder, dataProviderName, dataProviderClass, context); if (null == result) { throw new TestNGException( "Method " + m + " requires a @DataProvider named : " + dataProviderName + (dataProviderClass != null ? " in class " + dataProviderClass.getName() : "")); } } } return result; }
@Override public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) { if (Utils.isStringEmpty(config.getOutputDirectory())) { config.setOutputDirectory(outputDirectory);