@Test
public void testAroundWritePageWithExtensionContextWithExtendedType()
	throws IOException {

	JAXRSExtensionContextUtil.TestObject testObject =
		JAXRSExtensionContextUtil.getTestObject();
	Page<JAXRSExtensionContextUtil.TestObject> page = Page.of(
		Collections.singleton(testObject));
	ArgumentCaptor<Page> argumentCaptor = ArgumentCaptor.forClass(
		Page.class);
	Mockito.when(
		_writerInterceptorContext.getEntity()
	).thenReturn(
		page
	);
	Mockito.when(
		_writerInterceptorContext.getGenericType()
	).thenReturn(
		new GenericType<Page<JAXRSExtensionContextUtil.TestObject>>() {
		}.getType()
	);
	Mockito.when(
		_writerInterceptorContext.getType()
	).thenReturn(
		(Class)page.getClass()
	);
	_pageEntityExtensionWriterInterceptor.aroundWriteTo(
		_writerInterceptorContext);
	Mockito.verify(
		_writerInterceptorContext
	).setEntity(
		argumentCaptor.capture()
	);
	Page<ExtendedEntity> extendedEntityPage = argumentCaptor.getValue();
	Assert.assertEquals(page.getActions(), extendedEntityPage.getActions());
	Collection<ExtendedEntity> extendedEntities =
		extendedEntityPage.getItems();
	ExtendedEntity extendedEntity =
		extendedEntities.toArray(new ExtendedEntity[0])[0];
	Assert.assertEquals(testObject, extendedEntity.getEntity());
	Assert.assertEquals(
		JAXRSExtensionContextUtil.getTestExtendedProperties(),
		extendedEntity.getExtendedProperties());
	Assert.assertEquals(page.getLastPage(), page.getLastPage());
	Assert.assertEquals(page.getPage(), extendedEntityPage.getPage());
	Assert.assertEquals(
		page.getPageSize(), extendedEntityPage.getPageSize());
	Assert.assertEquals(page.getTotalCount(), page.getTotalCount());
	Mockito.verify(
		_writerInterceptorContext
	).setGenericType(
		eq(
			new GenericType<Page<ExtendedEntity>>() {
			}.getType())
	);
	Mockito.verify(
		_writerInterceptorContext
	).proceed();
}