Commit b810543
committed
Unify ClientSupport and StubRest client APIs
- New api is a wrapper above jersey client api to simplify test-specific configuration and validation
(jersey api is still available). The request builder unifies all possible configurations in one place.
- New common base class TestClient (and TestRestClient for rest clients, adding rest-specific methods)
- ClientSupport is a TestClient, but also could provide 3 special clients: appClient(), adminClient(), restClient()
(restClient() is the same as StubRest client)
- New sub clients could be created by applying additional path segments:
client.subClient("/sub/path/)
- External api client could be created with support.customClient("som external url")
- New client rest api based on real method calls: restClient(RestClass.class).method(mock -> mock.restMethod(args)).invoke()
(target path and method type resolved from annotations, arguments used for request configuration)
- Helper api for testing multipart requests: restClient(..).multipartMethod(..)
(simplifies multipart method arguments creation)
- Defaults mechanism: it is possible to declare default headers, cookies, etc.
on the client to be applied for all requests (evolution of StubRest client ideas)
- Add PATCH method shortcuts
- Add builder-style response assertions like: client.do_request.assertHeader("Name", val)
This allows checking response headers, cookies, status code, etc. in a chained calls style without additional variables
- Add connector switching api to ClientSupport: apacheClient(), urlconnectorClient()
This allows using different connectors within one test
(note that apache connector is required for PATCH calls and urlconnector better handles multipart requests)
- (BREAKING) previous target(String... path) methods replaced with string format: target(String, Object...args)
- (BREAKING) deprecated targetMain(): replaced with targetApp()
- (BREAKING) StubRest default status declaration removed as not useful
(required status could be declared now with the new request builder)1 parent f434dc0 commit b810543
111 files changed
Lines changed: 13313 additions & 951 deletions
File tree
- dropwizard-guicey/src
- doc/docs/guide/test
- general
- junit5
- main/java/ru/vyarus/dropwizard/guice
- module/installer/util
- test
- client
- builder
- call
- track
- impl
- mock
- util
- conf
- util
- jupiter
- ext/conf
- rest
- support
- url
- model
- resource
- util
- test/groovy/ru/vyarus/dropwizard/guice
- provider
- test
- client
- builder
- call
- track
- util
- support
- sub
- general
- jupiter
- dw
- guicey
- setup/rest
- rest/support
- url
- resource
- support
- examples
- ext-gsp-spa/src/test/groovy/ru/vyarus/dropwizard/guice/examples
- ext-spa/src/test/groovy/ru/vyarus/dropwizard/guice/examples
- integration-auth/src/test/groovy/ru/vyarus/dropwizard/guice/examples
- guicey-server-pages/src/test/groovy/ru/vyarus/guicey/gsp
- error
- spa
- guicey-spa/src/test/groovy/ru/vyarus/guicey/spa
- guicey-test-spock
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
21 | 44 | | |
22 | 45 | | |
23 | 46 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
0 commit comments