1
2
3
4
5 package com.jcabi.http;
6
7 import com.jcabi.http.request.ApacheRequest;
8 import com.jcabi.http.request.JdkRequest;
9 import java.lang.annotation.Retention;
10 import java.lang.annotation.RetentionPolicy;
11 import java.net.URI;
12 import lombok.SneakyThrows;
13 import org.junit.jupiter.params.provider.ValueSource;
14
15
16
17
18
19
20 @SuppressWarnings("PMD.AbstractClassWithoutAbstractMethod")
21 abstract class RequestTestTemplate {
22
23
24
25
26
27 @Retention(RetentionPolicy.RUNTIME)
28 @ValueSource(classes = {ApacheRequest.class, JdkRequest.class})
29 protected @interface Values {
30 }
31
32
33
34
35
36
37
38 @SneakyThrows
39 static Request request(final URI uri, final Class<? extends Request> type) {
40 return type.getDeclaredConstructor(URI.class).newInstance(uri);
41 }
42 }