@Operation(summary = "Get paginated list of connections based on conditions")
    @PostMapping(value = "/search", consumes = "application/json")
    @ResponseBody
    public Page<ConnectionResponse> search(@RequestBody Connection con,
                                           @RequestParam(name = "page", defaultValue = "0") int pageIndex,
                                           @RequestParam(name = "size", defaultValue = "30") int pageSize) {
        Page<Connection> allConnections = connectionService.search(con, pageIndex, pageSize);
        return connectionService.convertToConnectionResponse(allConnections);
    }
@Test
    public void getAllConnectionsBasedOnConditions() {
        when(connectionServiceMock.search(any(Connection.class), anyInt(), anyInt())).thenReturn(getPageConnections());
        when(connectionServiceMock.convertToConnectionResponse(any(Page.class))).thenReturn(getPageConnectionResponse());

        Page<ConnectionResponse> result = controllerMock.search(getNewConnection(), 1, 10);

        verify(connectionServiceMock, times(1)).search(any(Connection.class), anyInt(), anyInt());
        verify(connectionServiceMock, times(1)).convertToConnectionResponse(any(Page.class));
        assertNotNull(result);
        assertEquals(1, result.getTotalPages());
        assertEquals(1, result.getContent().size());
    }