@Before public void setUp() throws Exception { when(foo.locate(FOO + "." + BAR)).thenReturn(fooResulution); when(bar.locate(BAR)).thenReturn(barResolution); Map<String, ClassFileLocator> map = new HashMap<String, ClassFileLocator>(); map.put(FOO, foo); map.put(NamedElement.EMPTY_NAME, bar); classFileLocator = new ClassFileLocator.PackageDiscriminating(map); }
@Test public void testClose() throws Exception { classFileLocator.close(); verify(foo).close(); verifyNoMoreInteractions(foo); verify(bar).close(); verifyNoMoreInteractions(bar); }
@Test public void testInvalidLocation() throws Exception { assertThat(classFileLocator.locate(BAR + "." + FOO).isResolved(), is(false)); }
@Test public void testValidLocationDefaultPackage() throws Exception { assertThat(classFileLocator.locate(BAR), is(barResolution)); }
@Test public void testValidLocation() throws Exception { assertThat(classFileLocator.locate(FOO + "." + BAR), is(fooResulution)); }