Skip to content

Latest commit

 

History

History
16 lines (14 loc) · 767 Bytes

File metadata and controls

16 lines (14 loc) · 767 Bytes

Maintaining and Tracking XRayInterfaces

We have shown that XRayInterface provides a convenient interface to reflection. Yet it is not completely robust against refactorings. So we have to find a way to provide robustness with other means. Our recommendation: Just write a test for each pair of closed classes and feature interfaces, e.g. for the upper example:

import static net.amygdalum.xrayinterface.XRayMatcher.providesFeaturesOf;

...
	@Test
	public void testPreventRuntimeErrorsOnXRaying() throws Exception {
		assertThat(House.class, providesFeaturesOf(XRayed.class));
		assertThat(House.class, providesFeaturesOf(XRayedKey.class));
		assertThat(House.class, providesFeaturesOf(XRayedLock.class));
	}
...