temper.std.testing.Test Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of temper-std Show documentation
Show all versions of temper-std Show documentation
Optional support library provided with Temper
package temper.std.testing;
import temper.core.Nullable;
import java.util.List;
import temper.core.Core;
import java.util.function.Supplier;
import java.util.function.Function;
import java.util.ArrayList;
public final class Test {
public void assert_(boolean success__36, Supplier message__37) {
if (!success__36) {
this._passing = false;
Core.listAdd(this._messages, message__37.get());
} else {
/* null: Literal expression statement */
}
}
public void assertHard(boolean success__40, Supplier message__41) {
this.assert_(success__40, message__41);
if (!success__40) {
this._failedOnAssert = true;
Core.throwAssertionError(this.messagesCombined());
} else {
/* null: Literal expression statement */
}
}
public void softFailToHard() {
if (this.isHasUnhandledFail()) {
this._failedOnAssert = true;
Core.throwAssertionError(this.messagesCombined());
} else {
/* null: Literal expression statement */
}
}
public boolean isPassing() {
return this._passing;
}
public List messages() {
return List.copyOf(this._messages);
}
public boolean isFailedOnAssert() {
return this._failedOnAssert;
}
public boolean isHasUnhandledFail() {
boolean t_184;
if (this._failedOnAssert) {
t_184 = true;
} else {
t_184 = this._passing;
}
return !t_184;
}
public @Nullable String messagesCombined() {
@Nullable String return__30;
List t_287;
@Nullable String t_288;
if (this._messages.isEmpty()) {
return__30 = null;
} else {
t_287 = this._messages;
Function fn__284 = it__57 -> {
return it__57;
};
t_288 = Core.listJoinObj(t_287, ", ", fn__284);
return__30 = t_288;
}
return return__30;
}
boolean _failedOnAssert;
boolean _passing;
final List _messages;
public Test(@Nullable Boolean _failedOnAssert__62, @Nullable Boolean _passing__63, @Nullable List _messages__64) {
List t_281;
if (_failedOnAssert__62 == null) {
_failedOnAssert__62 = false;
}
if (_passing__63 == null) {
_passing__63 = true;
}
if (_messages__64 == null) {
t_281 = new ArrayList<>();
_messages__64 = t_281;
}
this._failedOnAssert = _failedOnAssert__62;
this._passing = _passing__63;
this._messages = _messages__64;
}
public Test(@Nullable Boolean _failedOnAssert__62, @Nullable Boolean _passing__63) {
this(_failedOnAssert__62, _passing__63, null);
}
public Test(@Nullable Boolean _failedOnAssert__62) {
this(_failedOnAssert__62, null, null);
}
public Test() {
this(null, null, null);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy