@Test
public void getModuleDependenciesWithFiltersOnScopes(){

    final DbModule module = new DbModule();
    module.setName("module");
    module.setVersion("1.0.0");
    final DbArtifact dependency1 = new DbArtifact();
    dependency1.setGroupId("org.axway.grapes.test");
    dependency1.setArtifactId("dependency1");
    dependency1.setVersion("123");
    module.addDependency(dependency1.getGavc(), Scope.COMPILE);
    final DbArtifact dependency2 = new DbArtifact();
    dependency2.setGroupId("org.axway.grapes.test");
    dependency2.setArtifactId("dependency2");
    dependency2.setVersion("456");
    module.addDependency(dependency2.getGavc(), Scope.PROVIDED);
    final DbArtifact dependency3 = new DbArtifact();
    dependency3.setGroupId("org.axway.grapes.test");
    dependency3.setArtifactId("dependency3");
    dependency3.setVersion("789");
    module.addDependency(dependency3.getGavc(), Scope.RUNTIME);
    final DbArtifact dependency4 = new DbArtifact();
    dependency4.setGroupId("org.axway.grapes.test");
    dependency4.setArtifactId("dependency4");
    dependency4.setVersion("101");
    module.addDependency(dependency4.getGavc(), Scope.TEST);
    final RepositoryHandler repositoryHandler = mock(RepositoryHandler.class);
    when(repositoryHandler.getModule(module.getId())).thenReturn(module);
    when(repositoryHandler.getArtifact(dependency1.getGavc())).thenReturn(dependency1);
    when(repositoryHandler.getArtifact(dependency2.getGavc())).thenReturn(dependency2);
    when(repositoryHandler.getArtifact(dependency3.getGavc())).thenReturn(dependency3);
    when(repositoryHandler.getArtifact(dependency4.getGavc())).thenReturn(dependency4);
    final FiltersHolder filters = new FiltersHolder();
    filters.getScopeHandler().setScopeComp(true);
    filters.getScopeHandler().setScopePro(false);
    filters.getScopeHandler().setScopeRun(false);
    filters.getScopeHandler().setScopeTest(false);
    filters.getDecorator().setShowThirdparty(true);
    final DependencyHandler dependencyHandler = new DependencyHandler(repositoryHandler);
    List<Dependency> dependencies = dependencyHandler.getModuleDependencies(module.getId(), filters);
    assertEquals(1, dependencies.size());
    assertEquals(dependency1.getGavc(), dependencies.get(0).getTarget().getGavc());
    filters.getScopeHandler().setScopeComp(false);
    filters.getScopeHandler().setScopePro(true);
    filters.getScopeHandler().setScopeRun(false);
    filters.getScopeHandler().setScopeTest(false);
    filters.getDecorator().setShowThirdparty(true);
    dependencies = dependencyHandler.getModuleDependencies(module.getId(), filters);
    assertEquals(1, dependencies.size());
    assertEquals(dependency2.getGavc(), dependencies.get(0).getTarget().getGavc());
    filters.getScopeHandler().setScopeComp(false);
    filters.getScopeHandler().setScopePro(false);
    filters.getScopeHandler().setScopeRun(true);
    filters.getScopeHandler().setScopeTest(false);
    filters.getDecorator().setShowThirdparty(true);
    dependencies = dependencyHandler.getModuleDependencies(module.getId(), filters);
    assertEquals(1, dependencies.size());
    assertEquals(dependency3.getGavc(), dependencies.get(0).getTarget().getGavc());
    filters.getScopeHandler().setScopeComp(false);
    filters.getScopeHandler().setScopePro(false);
    filters.getScopeHandler().setScopeRun(false);
    filters.getScopeHandler().setScopeTest(true);
    filters.getDecorator().setShowThirdparty(true);
    dependencies = dependencyHandler.getModuleDependencies(module.getId(), filters);
    assertEquals(1, dependencies.size());
    assertEquals(dependency4.getGavc(), dependencies.get(0).getTarget().getGavc());
}