### Question:
JwtAuthenticationService implements AuthenticationService { public boolean isSpecified() { return bearer != null; } JwtAuthenticationService(final ContainerRequest request); boolean isSpecified(); Principal authenticate();  }### Answer:
@Test public void isSpecifiedShouldReturnTrueWhenBearerIsNotNull() { final ContainerRequest containerRequestMock = mock(ContainerRequest.class); when(containerRequestMock.getRequestHeader(eq(HttpHeaders.AUTHORIZATION))) .thenReturn(Collections.singletonList("Bearer 123456")); final JwtAuthenticationService authService = new JwtAuthenticationService(containerRequestMock); assertThat(authService.isSpecified()).isTrue(); }
@Test public void isSpecifiedShouldReturnFalseWhenBearerIsNull() { final ContainerRequest containerRequestMock = mock(ContainerRequest.class); when(containerRequestMock.getRequestHeader(eq(HttpHeaders.AUTHORIZATION))) .thenReturn(Collections.singletonList("Basic 123456")); final JwtAuthenticationService authService = new JwtAuthenticationService(containerRequestMock); assertThat(authService.isSpecified()).isFalse(); }