### Question:
HttpRequestUuidResolver extends SingleComponentResolver<HttpCommand, Ignore> { @Override public void resolve(HttpCommand httpCommand, Ignore ignore, DehydratedExecutionContextBuilder builder) { RequestUUID requestUUID = resolve(httpCommand); builder.setRequestUUID(requestUUID); } HttpRequestUuidResolver(String uuidHeader, String uuidParentsHeader); @Override void resolve(HttpCommand httpCommand, Ignore ignore, DehydratedExecutionContextBuilder builder);  }### Answer:
@Test public void noHeadersFound() { uuidResolver.resolve(httpCommand, null, builder); assertNotNull(builder.getRequestUUID()); }
@Test public void blankMainHeader() { when(request.getHeader("X-UUID")).thenReturn(""); uuidResolver.resolve(httpCommand, null, builder); assertNotNull(builder.getRequestUUID()); }
@Test public void validMainHeader() { when(request.getHeader("X-UUID")).thenReturn("123456789-77777777-foo"); uuidResolver.resolve(httpCommand, null, builder); assertNotNull(builder.getRequestUUID()); assertEquals("123456789-77777777-foo",builder.getRequestUUID().toString()); }
@Test(expected = IllegalArgumentException.class) public void invalidMainHeader() { when(request.getHeader("X-UUID")).thenReturn("abc"); uuidResolver.resolve(httpCommand, null, builder); assertNotNull(builder.getRequestUUID()); }
@Test public void validMainHeaderBlankParentHeader() { when(request.getHeader("X-UUID")).thenReturn("123456789-77777777-foo"); when(request.getHeader("X-UUID-Parents")).thenReturn(""); uuidResolver.resolve(httpCommand, null, builder); assertNotNull(builder.getRequestUUID()); assertEquals("123456789-77777777-foo", builder.getRequestUUID().toString()); }
@Test public void validMainHeaderValidParentHeader() { when(request.getHeader("X-UUID")).thenReturn("123456789-77777777-foo"); when(request.getHeader("X-UUID-Parents")).thenReturn("123456789-77777777-root:123456789-77777777-parent"); uuidResolver.resolve(httpCommand, null, builder); assertNotNull(builder.getRequestUUID()); assertEquals("123456789-77777777-root:123456789-77777777-parent:123456789-77777777-foo", builder.getRequestUUID().toString()); }
@Test(expected = IllegalArgumentException.class) public void validMainHeaderInvalidParentHeader() { when(request.getHeader("X-UUID")).thenReturn("123456789-77777777-foo"); when(request.getHeader("X-UUID-Parents")).thenReturn("abc"); uuidResolver.resolve(httpCommand, null, builder); assertNotNull(builder.getRequestUUID()); }