Skip to content

Commit

Permalink
Update unit test to take correct versions into account
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Oct 4, 2023
1 parent d9315e6 commit a2cdd48
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,17 @@ public void testUseJDKSerializationHeaderIsSetOnMessageReceived() throws Excepti
TransportChannel transportChannel = mock(TransportChannel.class);
Task task = mock(Task.class);
doNothing().when(transportChannel).sendResponse(ArgumentMatchers.any(Exception.class));
when(transportChannel.getVersion()).thenReturn(Version.V_2_11_0);
when(transportChannel.getVersion()).thenReturn(Version.V_2_10_0);
when(transportChannel.getChannelType()).thenReturn("transport");

Assert.assertThrows(Exception.class, () -> securitySSLRequestHandler.messageReceived(transportRequest, transportChannel, task));
Assert.assertTrue(threadPool.getThreadContext().getTransient(ConfigConstants.USE_JDK_SERIALIZATION));

threadPool.getThreadContext().stashContext();
when(transportChannel.getVersion()).thenReturn(Version.V_2_11_0);
Assert.assertThrows(Exception.class, () -> securitySSLRequestHandler.messageReceived(transportRequest, transportChannel, task));
Assert.assertFalse(threadPool.getThreadContext().getTransient(ConfigConstants.USE_JDK_SERIALIZATION));

threadPool.getThreadContext().stashContext();
when(transportChannel.getVersion()).thenReturn(Version.V_3_0_0);
Assert.assertThrows(Exception.class, () -> securitySSLRequestHandler.messageReceived(transportRequest, transportChannel, task));
Expand Down

0 comments on commit a2cdd48

Please sign in to comment.