(Consumer<String> c, String s)
| 8 | |
| 9 | public class GuavaPreconditions { |
| 10 | static void test(Consumer<String> c, String s) { |
| 11 | try { |
| 12 | System.out.println(s); |
| 13 | c.accept(s); |
| 14 | System.out.println("Success"); |
| 15 | } catch(Exception e) { |
| 16 | String type = e.getClass().getSimpleName(); |
| 17 | String msg = e.getMessage(); |
| 18 | System.out.println(type + |
| 19 | (msg == null ? "" : ": " + msg)); |
| 20 | } |
| 21 | } |
| 22 | public static void main(String[] args) { |
| 23 | test(s -> s = checkNotNull(s), "X"); |
| 24 | test(s -> s = checkNotNull(s), null); |
no test coverage detected