@Override
    public Comparison compare(final Path.Type type, final PathAttributes local, final PathAttributes remote) {
        for(Iterator<ComparisonService> iter = Arrays.asList(delegates).iterator(); iter.hasNext(); ) {
            final ComparisonService delegate = iter.next();
            if(log.isDebugEnabled()) {
                log.debug(String.format("Compare local attributes %s with remote %s using %s", local, remote, delegate));
            }
            final Comparison result = delegate.compare(type, local, remote);
            if(skipped.contains(result)) {
                if(!iter.hasNext()) {
                    if(log.isDebugEnabled()) {
                        log.debug(String.format("Return %s from %s", result, delegate));
                    }
                    // Return regardless if last comparison
                    return result;
                }
                continue;
            }
            if(log.isDebugEnabled()) {
                log.debug(String.format("Return %s from %s", result, delegate));
            }
            return result;
        }
        return Comparison.unknown;
    }
@Test
    public void testCompare() {
        assertEquals(Comparison.equal, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
                Path.Type.file, new PathAttributes().withModificationDate(1000L), new PathAttributes().withModificationDate(1000L)
        ));
        assertEquals(Comparison.equal, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
                Path.Type.file, new PathAttributes().withModificationDate(1000L).withSize(1000L), new PathAttributes().withModificationDate(1000L).withSize(1000L)
        ));
        assertEquals(Comparison.remote, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
                Path.Type.file, new PathAttributes().withModificationDate(1000L), new PathAttributes().withModificationDate(2000L)
        ));
        assertEquals(Comparison.remote, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
                Path.Type.file, new PathAttributes().withModificationDate(1000L).withSize(1000L), new PathAttributes().withModificationDate(2000L).withSize(1000L)
        ));
        assertEquals(Comparison.unknown, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
                Path.Type.file, new PathAttributes(), new PathAttributes()
        ));
        assertEquals(Comparison.equal, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
                Path.Type.file, new PathAttributes().withModificationDate(1000L).withSize(1000L), new PathAttributes().withModificationDate(1000L).withSize(2000L)
        ));
        assertEquals(Comparison.notequal, new ChainedComparisonService(EnumSet.of(Comparison.unknown, Comparison.equal), new TimestampComparisonService(), new SizeComparisonService()).compare(
                Path.Type.file, new PathAttributes().withModificationDate(1000L).withSize(1000L), new PathAttributes().withModificationDate(1000L).withSize(2000L)
        ));
    }