@Override public Path resolveDefaultPath(Package pkg, String resourceType) { return resourceResolver.resolveDefaultPath(pkg, resourceType); }
@Test public void resolveDefaultPathWithErrors() { Package pkg = mock(Package.class); String resourceType = "any"; // if none of the configured ModuleResourcePathResolvers accepts the resourceType, and exception must have been // thrown. expectedException.expectMessage("No ModuleResourcePathResolver has been defined for resourceType: " + resourceType); resourceResolver.resolveDefaultPath(pkg, resourceType); }
@Test public void resolveDefaultPathWithErrors() { Package pkg = mock(Package.class); String resourceType = "any"; // if none of the configured ProjectResourcePathResolvers accepts the resourceType, and exception must have been // thrown. expectedException.expectMessage("No ProjectResourcePathResolver has been defined for resourceType: " + resourceType); resourceResolver.resolveDefaultPath(pkg, resourceType); }
@Test public void resolveDefaultPathWithErrors() { Package pkg = mock(Package.class); String resourceType = "any"; // if none of the configured ModuleResourcePathResolvers accepts the resourceType, and exception must have been // thrown. expectedException.expectMessage("No ModuleResourcePathResolver has been defined for resourceType: " + resourceType); resourceResolver.resolveDefaultPath(pkg, resourceType); }
@Test public void resolveDefaultPathSuccessful() { Package pkg = mock(Package.class); String resourceType = "any"; Path defaultPath = mock(Path.class); // pick one of the configured resolvers as the one that accepts the given resource type. ModuleResourcePathResolver blessedModuleResourcePathResolver = projectResourcePathResolvers.get(3); when(blessedModuleResourcePathResolver.accept(resourceType)).thenReturn(true); when(blessedModuleResourcePathResolver.resolveDefaultPath(pkg)).thenReturn(defaultPath); assertEquals(defaultPath, resourceResolver.resolveDefaultPath(pkg, resourceType)); verify(blessedModuleResourcePathResolver, times(1)).resolveDefaultPath(pkg); projectResourcePathResolvers.forEach(projectResourcePathResolver -> { if (projectResourcePathResolver != blessedModuleResourcePathResolver) { verify(projectResourcePathResolver, never()).resolveDefaultPath(any(Package.class)); } }); }
@Test public void resolveDefaultPathSuccessful() { Package pkg = mock(Package.class); String resourceType = "any"; Path defaultPath = mock(Path.class); // pick one of the configured resolvers as the one that accepts the given resource type. ProjectResourcePathResolver blessedProjectResourcePathResolver = projectResourcePathResolvers.get(3); when(blessedProjectResourcePathResolver.accept(resourceType)).thenReturn(true); when(blessedProjectResourcePathResolver.resolveDefaultPath(pkg)).thenReturn(defaultPath); assertEquals(defaultPath, resourceResolver.resolveDefaultPath(pkg, resourceType)); verify(blessedProjectResourcePathResolver, times(1)).resolveDefaultPath(pkg); projectResourcePathResolvers.forEach(projectResourcePathResolver -> { if (projectResourcePathResolver != blessedProjectResourcePathResolver) { verify(projectResourcePathResolver, never()).resolveDefaultPath(any(Package.class)); } }); }
@Test public void resolveDefaultPathSuccessful() { Package pkg = mock(Package.class); String resourceType = "any"; Path defaultPath = mock(Path.class); // pick one of the configured resolvers as the one that accepts the given resource type. ModuleResourcePathResolver blessedModuleResourcePathResolver = projectResourcePathResolvers.get(3); when(blessedModuleResourcePathResolver.accept(resourceType)).thenReturn(true); when(blessedModuleResourcePathResolver.resolveDefaultPath(pkg)).thenReturn(defaultPath); assertEquals(defaultPath, resourceResolver.resolveDefaultPath(pkg, resourceType)); verify(blessedModuleResourcePathResolver, times(1)).resolveDefaultPath(pkg); projectResourcePathResolvers.forEach(projectResourcePathResolver -> { if (projectResourcePathResolver != blessedModuleResourcePathResolver) { verify(projectResourcePathResolver, never()).resolveDefaultPath(any(Package.class)); } }); }