• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yuu-nkjm / sorm4j / #518

13 Mar 2025 07:20AM UTC coverage: 93.617% (-0.03%) from 93.65%
#518

push

Yuu NAKAJIMA
RefactoringTry

813 of 931 branches covered (87.33%)

Branch coverage included in aggregate %.

56 of 63 new or added lines in 10 files covered. (88.89%)

21 existing lines in 3 files now uncovered.

4188 of 4411 relevant lines covered (94.94%)

0.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/sorm4j/src/main/java/org/nkjmlab/sorm4j/internal/util/function/ThrowableFunction.java
1
package org.nkjmlab.sorm4j.internal.util.function;
2

3
import java.util.function.Function;
4

5
@FunctionalInterface
6
public interface ThrowableFunction<T, R> {
7
  R apply(T t) throws Exception;
8

9
  /**
10
   * @param <T>
11
   * @param <R>
12
   * @param onTry
13
   * @param exceptionHandler
14
   * @return
15
   */
16
  public static <T, R> Function<T, R> toFunction(
17
      ThrowableFunction<T, R> onTry, Function<Exception, R> exceptionHandler) {
18
    return x -> {
1✔
19
      try {
20
        return onTry.apply(x);
1✔
NEW
21
      } catch (Exception e) {
×
NEW
22
        return exceptionHandler.apply(e);
×
23
      }
24
    };
25
  }
26
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc