()
| 66 | }; |
| 67 | |
| 68 | const fixture = () => { |
| 69 | write('p/Shape.java', `package p; |
| 70 | public interface Shape { double norm(); } |
| 71 | `); |
| 72 | write('p/Point.java', `package p; |
| 73 | |
| 74 | public record Point(int x, int y) implements Shape { |
| 75 | public static final Point ORIGIN = new Point(0, 0); |
| 76 | public Point { |
| 77 | if (x < 0) throw new IllegalArgumentException(); |
| 78 | } |
| 79 | public Point(int v) { this(v, v); } |
| 80 | public double norm() { return Math.sqrt(x * x + y * y); } |
| 81 | record Inner(String name) {} |
| 82 | } |
| 83 | `); |
| 84 | write('p/Pair.java', `package p; |
| 85 | public record Pair<A, B>(A first, B second) { |
| 86 | public A left() { return first; } |
| 87 | } |
| 88 | `); |
| 89 | write('p/Http.java', `package p; |
| 90 | public class Http { |
| 91 | public record RemoteInfo(String remoteAddress, int port) { |
| 92 | public String describe() { return remoteAddress + ":" + port; } |
| 93 | public String remoteAddress() { return remoteAddress.trim(); } |
| 94 | } |
| 95 | private RemoteInfo info; |
| 96 | public String use(Point p, RemoteInfo param) { |
| 97 | Point local = new Point(1, 2); |
| 98 | double a = local.norm(); |
| 99 | double b = p.norm(); |
| 100 | String c = info.remoteAddress(); |
| 101 | String d = param.describe(); |
| 102 | int e = p.x(); |
| 103 | Pair<String, Integer> pr = new Pair<>("a", 1); |
| 104 | String f = pr.left(); |
| 105 | return c + d + a + b + e + f; |
| 106 | } |
| 107 | } |
| 108 | `); |
| 109 | }; |
| 110 | |
| 111 | it('indexes a record as a class that contains its members and implements its interfaces', async () => { |
| 112 | fixture(); |
no test coverage detected