|
33 | 33 | import org.restlet.data.Method; |
34 | 34 | import org.restlet.data.Protocol; |
35 | 35 | import org.restlet.data.Status; |
| 36 | +import org.restlet.engine.Engine; |
36 | 37 |
|
37 | 38 | /** |
38 | 39 | * Restlet unit tests for HTTP Basic authentication client/server. |
@@ -61,13 +62,6 @@ static Stream<Arguments> validCredentials() { |
61 | 62 | arguments(LONG_USERNAME, LONG_PASSWORD), arguments(SHORT_USERNAME, SHORT_PASSWORD)); |
62 | 63 | } |
63 | 64 |
|
64 | | - public static class AuthenticatedRestlet extends Restlet { |
65 | | - @Override |
66 | | - public void handle(Request request, Response response) { |
67 | | - response.setEntity(AUTHENTICATED_MSG, MediaType.TEXT_PLAIN); |
68 | | - } |
69 | | - } |
70 | | - |
71 | 65 | public static class TestVerifier extends MapVerifier { |
72 | 66 | public TestVerifier() { |
73 | 67 | getLocalSecrets().put(SHORT_USERNAME, SHORT_PASSWORD.toCharArray()); |
@@ -111,6 +105,13 @@ class TestHttpBasicServer { |
111 | 105 | private Request request; |
112 | 106 | private Client client; |
113 | 107 |
|
| 108 | + public static class AuthenticatedRestlet extends Restlet { |
| 109 | + @Override |
| 110 | + public void handle(Request request, Response response) { |
| 111 | + response.setEntity(AUTHENTICATED_MSG, MediaType.TEXT_PLAIN); |
| 112 | + } |
| 113 | + } |
| 114 | + |
114 | 115 | @Test |
115 | 116 | void HttpBasicNone() { |
116 | 117 | final Response response = client.handle(request); |
@@ -142,6 +143,9 @@ void testValidCredentials(final String login, final String password) throws Exce |
142 | 143 |
|
143 | 144 | @BeforeEach |
144 | 145 | void makeServer() throws Exception { |
| 146 | + Engine.clear(); |
| 147 | + Engine.getInstance(); |
| 148 | + |
145 | 149 | final String REALM = HttpBasicTestCase.class.getSimpleName(); |
146 | 150 | this.component = new Component(); |
147 | 151 | final Server server = this.component.getServers().add(Protocol.HTTP, 0); |
|
0 commit comments