84 lines
2.5 KiB
Java
84 lines
2.5 KiB
Java
|
package org.bouncycastle.util.test;
|
||
|
|
||
|
import org.bouncycastle.util.Strings;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class SimpleTestResult implements TestResult {
|
||
|
private static final String SEPARATOR = Strings.lineSeparator();
|
||
|
private Throwable exception;
|
||
|
private String message;
|
||
|
private boolean success;
|
||
|
|
||
|
@Override // org.bouncycastle.util.test.TestResult
|
||
|
public String toString() {
|
||
|
return this.message;
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.util.test.TestResult
|
||
|
public boolean isSuccessful() {
|
||
|
return this.success;
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.util.test.TestResult
|
||
|
public Throwable getException() {
|
||
|
return this.exception;
|
||
|
}
|
||
|
|
||
|
public static TestResult successful(Test test, String str) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(test.getName());
|
||
|
sb.append(": ");
|
||
|
sb.append(str);
|
||
|
return new SimpleTestResult(true, sb.toString());
|
||
|
}
|
||
|
|
||
|
public static String failedMessage(String str, String str2, String str3, String str4) {
|
||
|
StringBuffer stringBuffer = new StringBuffer(str);
|
||
|
stringBuffer.append(" failing ").append(str2);
|
||
|
String str5 = SEPARATOR;
|
||
|
stringBuffer.append(str5).append(" expected: ").append(str3);
|
||
|
stringBuffer.append(str5).append(" got : ").append(str4);
|
||
|
return stringBuffer.toString();
|
||
|
}
|
||
|
|
||
|
public static TestResult failed(Test test, String str, Throwable th) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(test.getName());
|
||
|
sb.append(": ");
|
||
|
sb.append(str);
|
||
|
return new SimpleTestResult(false, sb.toString(), th);
|
||
|
}
|
||
|
|
||
|
public static TestResult failed(Test test, String str, Object obj, Object obj2) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(str);
|
||
|
String str2 = SEPARATOR;
|
||
|
sb.append(str2);
|
||
|
sb.append("Expected: ");
|
||
|
sb.append(obj);
|
||
|
sb.append(str2);
|
||
|
sb.append("Found : ");
|
||
|
sb.append(obj2);
|
||
|
return failed(test, sb.toString());
|
||
|
}
|
||
|
|
||
|
public static TestResult failed(Test test, String str) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(test.getName());
|
||
|
sb.append(": ");
|
||
|
sb.append(str);
|
||
|
return new SimpleTestResult(false, sb.toString());
|
||
|
}
|
||
|
|
||
|
public SimpleTestResult(boolean z, String str, Throwable th) {
|
||
|
this.success = z;
|
||
|
this.message = str;
|
||
|
this.exception = th;
|
||
|
}
|
||
|
|
||
|
public SimpleTestResult(boolean z, String str) {
|
||
|
this.success = z;
|
||
|
this.message = str;
|
||
|
}
|
||
|
}
|