com.google.common.truth.Subject.getSubject()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(120)

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

Subject.getSubject介绍

暂无

代码示例

代码示例来源:origin: google/truth

/** Returns the unedited, unformatted raw actual value. */
protected final T actual() {
 return getSubject();
}

代码示例来源:origin: org.truth0/truth

protected String getDisplaySubject() {
 return (customName == null)
   ? "<" + getSubject() + ">"
   : "\"" + this.customName + "\"";
}

代码示例来源:origin: org.truth0/truth

public void isEqualTo(Object other) {
 if (getSubject() == null) {
  if(other != null) {
   fail("is equal to", other);
  }
 } else {
  if (!getSubject().equals(other)) {
   fail("is equal to", other);
  }
 }
}

代码示例来源:origin: org.truth0/truth

public void isNotNull() {
 if (getSubject() == null) {
  failWithoutSubject("is a non-null reference");
 }
}

代码示例来源:origin: org.truth0/truth

public void isNull() {
 if (getSubject() != null) {
  failWithoutSubject("is a null reference");
 }
}

代码示例来源:origin: org.truth0/truth

public void isNotEqualTo(Object other) {
 if (getSubject() == null) {
  if(other == null) {
   fail("is not equal to", (Object)null);
  }
 } else {
  if (getSubject().equals(other)) {
   fail("is not equal to", other);
  }
 }
}

代码示例来源:origin: org.truth0/truth

public void isA(Class<?> clazz) {
 if (clazz == null) {
  throw new NullPointerException("clazz");
 }
 if (!Platform.isInstanceOfType(getSubject(), clazz)) {
  if (getSubject() != null) {
   failWithBadResults("is an instance of", clazz.getName(),
     "is an instance of", getSubject().getClass().getName());
  } else {
   fail("is an instance of", clazz.getName());
  }
 }
}

代码示例来源:origin: org.truth0/truth

public void isNotA(Class<?> clazz) {
 if (clazz == null) {
  throw new NullPointerException("clazz");
 }
 if (getSubject() == null) {
  return; // null is not an instance of clazz.
 }
 if (Platform.isInstanceOfType(getSubject(), clazz)) {
  failWithRawMessage("%s expected not to be an instance of %s, but was.",
    getDisplaySubject(), clazz.getName());
 }
}

代码示例来源:origin: org.truth0/truth

@GwtIncompatible("java.lang.reflect.Field")
public HasField hasField(final String fieldName) {
 final T subject = getSubject();
 if (subject == null) {
  failureStrategy.fail("Cannot determine a field name from a null object.");

相关文章