@SuppressWarnings("deprecation")
@Test(expected=ValidationException.class)
public void onHttpResultShouldThrowExceptionsOnMoved() throws Exception {

	HttpResult httpResult = mock(HttpResult.class);
	when(result.use(HttpResult.class)).thenReturn(httpResult);
	when(httpResult.movedPermanentlyTo(RandomComponent.class)).thenReturn(new RandomComponent());
	try {
		factory.instanceFor(HttpResult.class, errors).movedPermanentlyTo(RandomComponent.class);
	} catch (ValidationException e) {
		Assert.fail("The exception must occur only on method call");
	}
	factory.instanceFor(HttpResult.class, errors).movedPermanentlyTo(RandomComponent.class).random();
}