aboutsummaryrefslogtreecommitdiffstats
path: root/compatibility-server/src/test/java/com/vaadin/tests/server/DeprecatedTest.java
blob: 9e6bbf0a2797f82d2228bf5b573b16a01d24773d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.vaadin.tests.server;

import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;

import java.io.File;
import java.net.URISyntaxException;
import java.util.concurrent.atomic.AtomicInteger;

import org.junit.Test;

/**
 * @author Vaadin Ltd
 *
 */
public class DeprecatedTest {

    @Test
    public void allTypesAreDeprecated() throws URISyntaxException {
        AtomicInteger count = new AtomicInteger(0);

        File testRoot = new File(DeprecatedTest.class.getResource("/").toURI());

        new ClasspathHelper()
                .getVaadinClassesFromClasspath(
                        entry -> entry.contains("compatibility-server")
                                && !testRoot.equals(new File(entry)))
                .forEach(cls -> {
                    count.incrementAndGet();
                    assertNotNull("Class " + cls
                            + " is in compatability package and it's not deprecated",
                            cls.getAnnotation(Deprecated.class));
                });
        assertNotEquals("Total number of checked classes", 0, count.get());
    }

}