Search in sources :

Example 1 with NotASocket

use of org.eclipse.jetty.websocket.common.annotations.NotASocket in project jetty.project by eclipse.

the class EventDriverFactoryTest method testBadNotASocket.

/**
     * Test Case for bad declaration (duplicate OnWebSocketBinary declarations)
     */
@Test
public void testBadNotASocket() {
    EventDriverFactory factory = new EventDriverFactory(new SimpleContainerScope(WebSocketPolicy.newClientPolicy()));
    try {
        NotASocket bad = new NotASocket();
        // Should toss exception
        factory.wrap(bad);
    } catch (InvalidWebSocketException e) {
        // Validate that we have clear error message to the developer
        Assert.assertThat(e.getMessage(), allOf(containsString(WebSocketListener.class.getSimpleName()), containsString(WebSocket.class.getSimpleName())));
    }
}
Also used : InvalidWebSocketException(org.eclipse.jetty.websocket.api.InvalidWebSocketException) NotASocket(org.eclipse.jetty.websocket.common.annotations.NotASocket) SimpleContainerScope(org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope) Test(org.junit.Test)

Aggregations

InvalidWebSocketException (org.eclipse.jetty.websocket.api.InvalidWebSocketException)1 NotASocket (org.eclipse.jetty.websocket.common.annotations.NotASocket)1 SimpleContainerScope (org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope)1 Test (org.junit.Test)1