本文整理了Java中com.google.common.truth.Subject.getSubject()
方法的一些代码示例,展示了Subject.getSubject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subject.getSubject()
方法的具体详情如下:
包路径:com.google.common.truth.Subject
类名称: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.");
内容来源于网络,如有侵权,请联系作者删除!