Checking Success or Failure
How to find out if the operation succeded or failed
Checking Success
@Test
void testHasSuccess() {
// Given
Result<?, ?> result1 = success(1024);
Result<?, ?> result2 = failure(1024);
// When
boolean result1HasSuccess = result1.hasSuccess();
boolean result2HasSuccess = result2.hasSuccess();
// Then
assertTrue(result1HasSuccess);
assertFalse(result2HasSuccess);
}Checking Failure
Conclusion
Last updated
Was this helpful?