org.testng.internal.Utils.isStringEmpty()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(209)

本文整理了Java中org.testng.internal.Utils.isStringEmpty()方法的一些代码示例,展示了Utils.isStringEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isStringEmpty()方法的具体详情如下:
包路径:org.testng.internal.Utils
类名称:Utils
方法名:isStringEmpty

Utils.isStringEmpty介绍

暂无

代码示例

代码示例来源:origin: org.testng/testng

@Override
 public boolean isDefault(String s) {
  return Utils.isStringEmpty(s);
 }
};

代码示例来源:origin: org.testng/testng

public static String defaultIfStringEmpty(String s, String defaultValue) {
 return isStringEmpty(s) ? defaultValue : s;
}

代码示例来源:origin: org.testng/testng

public static boolean isStringNotEmpty(String s) {
 return !isStringEmpty(s);
}

代码示例来源:origin: cbeust/testng

public static String defaultIfStringEmpty(String s, String defaultValue) {
 return isStringEmpty(s) ? defaultValue : s;
}

代码示例来源:origin: cbeust/testng

public static boolean isStringNotEmpty(String s) {
 return !isStringEmpty(s);
}

代码示例来源:origin: org.testng/testng

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;
 }
}

代码示例来源:origin: cbeust/testng

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;
 }
}

代码示例来源:origin: org.testng/testng

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");
  }
 }
}

代码示例来源:origin: org.testng/testng

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);

代码示例来源:origin: cbeust/testng

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");
  }
 }
}

代码示例来源:origin: org.testng/testng

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;
}

代码示例来源:origin: org.testng/testng

String in = m_currentInclude.invocationNumbers;
XmlInclude include;
if (!Utils.isStringEmpty(in)) {
 include = new XmlInclude(name, stringToList(in), m_currentIncludeIndex++);
} else {

代码示例来源:origin: cbeust/testng

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;
}

代码示例来源:origin: org.testng/testng

return;
if (isStringEmpty(m_jarPath)) {
 return;

代码示例来源:origin: cbeust/testng

String in = m_currentInclude.invocationNumbers;
XmlInclude include;
if (!Utils.isStringEmpty(in)) {
 include = new XmlInclude(name, stringToList(in), m_currentIncludeIndex++);
} else {

代码示例来源:origin: org.testng/testng

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;
}

代码示例来源:origin: org.testng/testng

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);

代码示例来源:origin: org.testng/testng

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();
 }
}

代码示例来源:origin: cbeust/testng

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;
}

代码示例来源:origin: org.testng/testng

@Override
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites,
  String outputDirectory) {
 if (Utils.isStringEmpty(config.getOutputDirectory())) {
  config.setOutputDirectory(outputDirectory);

相关文章