### Question:
BasicGlobalExceptionHandler { protected List<String> getHeaderInfos(HttpServletRequest req) { final List<String> result = new ArrayList<String>(); @SuppressWarnings("unchecked") final Enumeration<String> headerNames = req.getHeaderNames(); while (headerNames != null && headerNames.hasMoreElements()) { final String headerName = headerNames.nextElement(); result.add("Header " + headerName + " = " + req.getHeader(headerName)); } return result; } BasicGlobalExceptionHandler(String defaultErrorView);   }### Answer:
@Test public void testGetHeaderInfos() { when(requestMock.getHeaderNames()).thenReturn( Collections.enumeration(Arrays.asList("A", "B"))); when(requestMock.getHeader("A")).thenReturn("Value A"); when(requestMock.getHeader("B")).thenReturn("Value B"); final List<String> headerInfos = testee.getHeaderInfos(requestMock); assertThat(headerInfos).hasSize(2).containsOnly("Header A = Value A", "Header B = Value B"); }