Commit 32b0bf5
authored
fix tests that fail for the wrong reasons (#45)
I noticed that the test `assertJwtEndpointWithNoKeyThrows()` was taking
10 seconds to run so I took a look into why that was.
The test method has `@Test(expected=Exception.class)` but the exception
that is thrown is different than the one that the test is expected - the
test was throwing a SocketTimeoutException after 10 seconds (which is
the OkHttpClient's default read timeout setting) because there was no
mock requests enqueued in the mock web server.
I refactored these tests to use `assertThrows` instead to assert against
the details of the thrown Exceptions, and also fixed what seems like a
bug in the `getAuthorizationHeader` method - if the client has an
accessToken, it will be used as the header, even if the request path is
one that needs a private-key-signed JWT token.1 parent 29c6266 commit 32b0bf5
File tree
3 files changed
+49
-11
lines changed- src
- main/java/com/spotify/github/v3/clients
- test/java/com/spotify/github/v3/clients
3 files changed
+49
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
545 | 548 | | |
546 | 549 | | |
547 | 550 | | |
| |||
603 | 606 | | |
604 | 607 | | |
605 | 608 | | |
606 | | - | |
| 609 | + | |
607 | 610 | | |
608 | 611 | | |
609 | | - | |
| 612 | + | |
610 | 613 | | |
611 | 614 | | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
612 | 622 | | |
613 | 623 | | |
614 | 624 | | |
| |||
Lines changed: 36 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| |||
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
75 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| |||
139 | 149 | | |
140 | 150 | | |
141 | 151 | | |
142 | | - | |
143 | | - | |
| 152 | + | |
| 153 | + | |
144 | 154 | | |
145 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
146 | 166 | | |
147 | 167 | | |
148 | 168 | | |
| |||
178 | 198 | | |
179 | 199 | | |
180 | 200 | | |
181 | | - | |
| 201 | + | |
182 | 202 | | |
183 | 203 | | |
184 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
185 | 208 | | |
186 | 209 | | |
187 | | - | |
| 210 | + | |
188 | 211 | | |
189 | 212 | | |
190 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
191 | 219 | | |
192 | 220 | | |
193 | 221 | | |
| |||
0 commit comments