### Question:
ContainerFeatureSetRequestFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext requestContext) throws IOException { final MultivaluedMap<String, String> headersMap = requestContext.getHeaders(); FeaturesContextHolder.clear(); if (headersMap.containsKey(FEATURE_SET_ID_HEADER)) { for (final String featureSetId : headersMap.get(FEATURE_SET_ID_HEADER)) { if (!featureSetId.isEmpty()) { FeaturesContextHolder.set(new FeaturesContext(featureSetId)); } } } }  @Override void filter(final ContainerRequestContext requestContext);  }### Answer:
@Test public void shouldSetFeatureSet_withFeatureSetHeader() throws Exception { mockStatic(FeaturesContextHolder.class); final String featureSetId = randomId(); final ContainerRequestContext mockContainerRequestContext = mock(ContainerRequestContext.class); final MultivaluedMap<String, String> headersMap = new MultivaluedHashMap<>(); headersMap.add(FEATURE_SET_ID_HEADER, featureSetId); when(mockContainerRequestContext.getHeaders()).thenReturn(headersMap); final ContainerFeatureSetRequestFilter containerFeatureSetRequestFilter = new ContainerFeatureSetRequestFilter(); containerFeatureSetRequestFilter.filter(mockContainerRequestContext); final ArgumentCaptor<FeaturesContext> featuresContextCaptor = ArgumentCaptor.forClass(FeaturesContext.class); verifyStatic(FeaturesContextHolder.class); FeaturesContextHolder.set(featuresContextCaptor.capture()); assertThat(featuresContextCaptor.getValue().featureSetId(), is(featureSetId)); }
@Test public void shouldNotSetFeatureSet_withNoHeader() throws Exception { mockStatic(FeaturesContextHolder.class); final ContainerRequestContext mockContainerRequestContext = mock(ContainerRequestContext.class); final MultivaluedMap<String, String> headersMap = new MultivaluedHashMap<>(); when(mockContainerRequestContext.getHeaders()).thenReturn(headersMap); final ContainerFeatureSetRequestFilter containerFeatureSetRequestFilter = new ContainerFeatureSetRequestFilter(); containerFeatureSetRequestFilter.filter(mockContainerRequestContext); verifyStatic(FeaturesContextHolder.class); FeaturesContextHolder.clear(); }