Skip to content

Commit b84bc26

Browse files
committed
Take into account Sonar comments
1 parent 7346571 commit b84bc26

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

org.restlet/src/test/java/org/restlet/security/HttpBasicTestCase.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.restlet.data.Method;
3434
import org.restlet.data.Protocol;
3535
import org.restlet.data.Status;
36+
import org.restlet.engine.Engine;
3637

3738
/**
3839
* Restlet unit tests for HTTP Basic authentication client/server.
@@ -61,13 +62,6 @@ static Stream<Arguments> validCredentials() {
6162
arguments(LONG_USERNAME, LONG_PASSWORD), arguments(SHORT_USERNAME, SHORT_PASSWORD));
6263
}
6364

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-
7165
public static class TestVerifier extends MapVerifier {
7266
public TestVerifier() {
7367
getLocalSecrets().put(SHORT_USERNAME, SHORT_PASSWORD.toCharArray());
@@ -111,6 +105,13 @@ class TestHttpBasicServer {
111105
private Request request;
112106
private Client client;
113107

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+
114115
@Test
115116
void HttpBasicNone() {
116117
final Response response = client.handle(request);
@@ -142,6 +143,9 @@ void testValidCredentials(final String login, final String password) throws Exce
142143

143144
@BeforeEach
144145
void makeServer() throws Exception {
146+
Engine.clear();
147+
Engine.getInstance();
148+
145149
final String REALM = HttpBasicTestCase.class.getSimpleName();
146150
this.component = new Component();
147151
final Server server = this.component.getServers().add(Protocol.HTTP, 0);

0 commit comments

Comments
 (0)