예제 #1
0
  @Test
  public final void testLocateFallback() throws Exception {
    final FileLocator locator = mock(FileLocator.class);
    final FileLocator fallbackLocator = mock(FileLocator.class);
    when(locator.locate("some-file")).thenReturn(new File("non-existent-file"));

    new FallbackFileLocator(locator, fallbackLocator).locate("some-file");

    verify(fallbackLocator).locate("some-file");
  }
예제 #2
0
  @Test
  public final void testLocateNoFallback() throws Exception {
    final FileLocator locator = mock(FileLocator.class);
    final FileLocator fallbackLocator = mock(FileLocator.class);
    when(locator.locate("some-file")).thenReturn(new File("."));

    new FallbackFileLocator(locator, fallbackLocator).locate("some-file");

    verify(fallbackLocator, never()).locate(anyString());
  }