@Test
public void testFilter() throws IOException {

	NestedFieldsContainerRequestFilter nestedFieldsContainerRequestFilter =
		new NestedFieldsContainerRequestFilter();
	ContainerRequestContext containerRequestContext = Mockito.mock(
		ContainerRequestContext.class);
	UriInfo uriInfo = Mockito.mock(UriInfo.class);
	Mockito.when(
		containerRequestContext.getUriInfo()
	).thenReturn(
		uriInfo
	);
	List<PathSegment> pathSegments = new ArrayList<>();
	pathSegments.add(new PathSegmentImpl("v1.0"));
	pathSegments.add(new PathSegmentImpl("products"));
	Mockito.when(
		uriInfo.getPathSegments()
	).thenReturn(
		pathSegments
	);
	MultivaluedMap<String, String> queryParameters =
		new MultivaluedHashMap<>();
	Mockito.when(
		uriInfo.getQueryParameters()
	).thenReturn(
		queryParameters
	);
	nestedFieldsContainerRequestFilter.filter(containerRequestContext);
	NestedFieldsContext nestedFieldsContext =
		NestedFieldsContextThreadLocal.getNestedFieldsContext();
	Assert.assertNull(nestedFieldsContext);
	queryParameters.putSingle("nestedFields", "skus,productOptions");
	nestedFieldsContainerRequestFilter.filter(containerRequestContext);
	nestedFieldsContext =
		NestedFieldsContextThreadLocal.getNestedFieldsContext();
	List<String> fieldNames = nestedFieldsContext.getFieldNames();
	Assert.assertEquals(fieldNames.toString(), 2, fieldNames.size());
}