Я реализовал связывание метода mocking, но метод Collectors.joining () не работает в mock.
HttpServletRequest context =PowerMockito.mock(HttpServletRequest.class);
BufferedReader bufferedReader =
PowerMockito.mock(BufferedReader.class);
Stream<String> stream = PowerMockito.mock(Stream.class);
Collector collector = PowerMockito.mock(Collector.class);
PowerMockito.when(context.getParameter("grant_type")).thenReturn("the value");
PowerMockito.when(context.getReader()).thenReturn(bufferedReader);
PowerMockito.when(context.getReader().lines()).thenReturn(stream);
PowerMockito.when(Collectors.joining()).thenReturn(collector);
PowerMockito.when(context.getReader().lines().collect(Collectors.joining())).thenReturn("the value");