File tree 4 files changed +11
-10
lines changed
main/java/io/securecodebox/persistence/defectdojo
test/java/io/securecodebox/persistence/defectdojo/http 4 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 13
13
import org .springframework .web .client .RestTemplate ;
14
14
15
15
/**
16
- * Placeholder to move duplicated code, will be named better later
16
+ * Factory to create preconfigured {@link RestTemplate}
17
17
*/
18
18
@ Slf4j
19
- public final class Foo {
19
+ public final class RestTemplateFactory {
20
20
private final ProxyConfig proxyConfig ;
21
21
22
- public Foo (@ NonNull ProxyConfig proxyConfig ) {
22
+ public RestTemplateFactory (@ NonNull ProxyConfig proxyConfig ) {
23
23
super ();
24
24
this .proxyConfig = proxyConfig ;
25
25
}
Original file line number Diff line number Diff line change 8
8
import io .securecodebox .persistence .defectdojo .config .ClientConfig ;
9
9
import io .securecodebox .persistence .defectdojo .exception .TooManyResponsesException ;
10
10
import io .securecodebox .persistence .defectdojo .http .AuthHeaderFactory ;
11
- import io .securecodebox .persistence .defectdojo .http .Foo ;
11
+ import io .securecodebox .persistence .defectdojo .http .RestTemplateFactory ;
12
12
import io .securecodebox .persistence .defectdojo .http .ProxyConfig ;
13
13
import io .securecodebox .persistence .defectdojo .http .ProxyConfigFactory ;
14
14
import io .securecodebox .persistence .defectdojo .model .Model ;
@@ -199,7 +199,8 @@ private HttpHeaders createAuthorizationHeaders() {
199
199
}
200
200
201
201
private RestTemplate setupRestTemplate () {
202
- final RestTemplate template = new Foo (new ProxyConfigFactory ().create ()).createRestTemplate ();
202
+ final RestTemplate template = new RestTemplateFactory (new ProxyConfigFactory ().create ()).createRestTemplate ();
203
+ // TODO: Maybe all of this could be moved into the factory.
203
204
final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter ();
204
205
converter .setObjectMapper (mapper .modelObjectMapper ());
205
206
template .setMessageConverters (List .of (
Original file line number Diff line number Diff line change 9
9
import io .securecodebox .persistence .defectdojo .config .ClientConfig ;
10
10
import io .securecodebox .persistence .defectdojo .exception .PersistenceException ;
11
11
import io .securecodebox .persistence .defectdojo .http .AuthHeaderFactory ;
12
- import io .securecodebox .persistence .defectdojo .http .Foo ;
12
+ import io .securecodebox .persistence .defectdojo .http .RestTemplateFactory ;
13
13
import io .securecodebox .persistence .defectdojo .http .ProxyConfigFactory ;
14
14
import io .securecodebox .persistence .defectdojo .model .ScanFile ;
15
15
import lombok .Data ;
@@ -54,7 +54,7 @@ private HttpHeaders getDefectDojoAuthorizationHeaders() {
54
54
}
55
55
56
56
protected RestTemplate setupRestTemplate () {
57
- return new Foo (new ProxyConfigFactory ().create ()).createRestTemplate ();
57
+ return new RestTemplateFactory (new ProxyConfigFactory ().create ()).createRestTemplate ();
58
58
}
59
59
60
60
/**
Original file line number Diff line number Diff line change 11
11
import static org .junit .jupiter .api .Assertions .assertAll ;
12
12
13
13
/**
14
- * Tests for {@link Foo }
14
+ * Tests for {@link RestTemplateFactory }
15
15
*/
16
- class FooTest {
16
+ class RestTemplateFactoryTest {
17
17
private final ProxyConfig proxyConfig = ProxyConfig .builder ()
18
18
.user ("user" )
19
19
.password ("pw" )
20
20
.host ("host" )
21
21
.port (42 )
22
22
.build ();
23
- private final Foo sut = new Foo (proxyConfig );
23
+ private final RestTemplateFactory sut = new RestTemplateFactory (proxyConfig );
24
24
25
25
26
26
You can’t perform that action at this time.
0 commit comments