Result { public static <U> Result<U> success(U value) { return new SuccessResult<>(value); }  abstract boolean isSuccess(); abstract T getValue(); abstract ResultStatus getStatus(); abstract String getFailureMessage(); abstract ImmutableSet<Failure> getFailures(); abstract Result<U> ifSuccess(Function<T, Result<U>> function); Result<U> flatMap(Function<T, Result<U>> function); abstract Result<V> combineWith(Result<U> other, Function2<T, U, Result<V>> function); @Deprecated boolean isValueAvailable(); @Deprecated Result<U> propagateFailure(); @Deprecated Result<U> map(final ResultMapper<T, U> function); static Result<U> success(U value); static Result<U> failure(FailureStatus status, String message, Object... messageArgs); static Result<U> failure(Exception exception, String message, Object... messageArgs); static Result<U> failure(Exception exception); static Result<U> failure(FailureStatus status, Exception exception); static Result<U> failure(FailureStatus status, Exception exception, String message, Object... messageArgs); @SuppressWarnings("unchecked") static Result<U> failure(Result<?> result); static Result<U> failure(Result<?> result1, Result<?> result2, Result<?>... results); static Result<U> failure(Iterable<? extends Result<?>> results); static boolean allSuccessful(Result<?>... results); static boolean allSuccessful(Iterable<? extends Result<?>> results); static boolean anyFailures(Result<?>... results); static boolean anyFailures(Iterable<? extends Result<?>> results);  }
@Test public void success() { Result<String> test = Result.success("success"); assertEquals(true, test.isSuccess()); assertEquals(SuccessStatus.SUCCESS, test.getStatus()); assertEquals("success", test.getValue()); }