Projekt

Obecné

Profil

« Předchozí | Další » 

Revize b88baba4

Přidáno uživatelem Patrik Harag před více než 5 roky(ů)

Change version of JUnit in Spade converter module (#7266)

  • JUnit 5 is currently not supported in Maven

Zobrazit rozdíly:

sources/imiger-spade-converter/pom.xml
79 79

  
80 80
        <!-- Libs for Unit testing -->
81 81
        <dependency>
82
            <groupId>org.junit.jupiter</groupId>
83
            <artifactId>junit-jupiter-api</artifactId>
84
            <version>5.3.2</version>
82
            <groupId>junit</groupId>
83
            <artifactId>junit</artifactId>
84
            <version>4.12</version>
85 85
            <scope>test</scope>
86 86
        </dependency>
87 87
    </dependencies>
sources/imiger-spade-converter/src/test/java/cz/zcu/kiv/imiger/plugin/spade/backend/GraphFilterTest.java
7 7
import cz.zcu.kiv.imiger.plugin.spade.graph.loader.GraphJSONDataLoader;
8 8
import cz.zcu.kiv.imiger.plugin.spade.graph.loader.JSONConfigLoader;
9 9
import cz.zcu.kiv.imiger.vo.SubedgeInfo;
10
import java.io.InputStream;
10 11
import org.apache.commons.io.IOUtils;
11
import org.junit.jupiter.api.Assertions;
12
import org.junit.jupiter.api.BeforeAll;
13
import org.junit.jupiter.api.Test;
12
import org.junit.Assert;
13
import org.junit.BeforeClass;
14
import org.junit.Test;
14 15

  
15 16
import java.io.File;
16 17
import java.io.IOException;
......
21 22

  
22 23
    private static GraphManager graphManager;
23 24

  
24
    @BeforeAll
25
    static void initTest() throws IOException {
26
        String loadedJSON = IOUtils.toString(GraphFilterTest.class.getClassLoader().getResourceAsStream("data/test1.json"), "UTF-8");
25
    @BeforeClass
26
    public static void initTest() throws IOException {
27
        InputStream resource = GraphFilterTest.class.getClassLoader().getResourceAsStream("data/test1.json");
28
        String loadedJSON = IOUtils.toString(resource, "UTF-8");
27 29
        graphManager = new GraphJSONDataLoader(loadedJSON).loadData();
28 30
    }
29 31

  
30 32
    @Test
31
    void testFilter1a() {
33
    public void testFilter1a() {
32 34
        Graph graph = createGraph("config/test1a.json");
33 35

  
34 36
        List<Integer> vertexIds = new ArrayList<>();
......
55 57
    }
56 58

  
57 59
    @Test
58
    void testFilter1b() {
60
    public void testFilter1b() {
59 61
        Graph graph = createGraph("config/test1b.json");
60 62

  
61 63
        List<Integer> vertexIds = new ArrayList<>();
......
77 79
    }
78 80

  
79 81
    @Test
80
    void testFilter1c() {
82
    public void testFilter1c() {
81 83
        Graph graph = createGraph("config/test1c.json");
82 84

  
83 85
        List<Integer> vertexIds = new ArrayList<>();
......
99 101
    }
100 102

  
101 103
    @Test
102
    void testFilter1d() {
104
    public void testFilter1d() {
103 105
        Graph graph = createGraph("config/test1d.json");
104 106

  
105 107
        List<Integer> vertexIds = new ArrayList<>();
......
121 123
    }
122 124

  
123 125
    @Test
124
    void testFilter1e() {
126
    public void testFilter1e() {
125 127
        Graph graph = createGraph("config/test1e.json");
126 128

  
127 129
        List<Integer> vertexIds = new ArrayList<>();
......
143 145
    }
144 146

  
145 147
    @Test
146
    void testFilter1f() {
148
    public void testFilter1f() {
147 149
        Graph graph = createGraph("config/test1f.json");
148 150

  
149 151
        List<Integer> vertexIds = new ArrayList<>();
......
179 181
     * @param edges - edges, that graph must contain in order to pass the test.
180 182
     */
181 183
    private void graphContains(Graph graph, List<Integer> vertexIds, List<Edge> edges) {
182
        Assertions.assertEquals(graph.getVertices().size(), vertexIds.size());
183
        Assertions.assertEquals(graph.getEdges().size(), edges.size());
184
        Assert.assertEquals(graph.getVertices().size(), vertexIds.size());
185
        Assert.assertEquals(graph.getEdges().size(), edges.size());
184 186

  
185 187
        // Vertices
186 188
        for (Vertex vertex : graph.getVertices()) {
187
            Assertions.assertTrue(vertexIds.contains(vertex.getId()));
189
            Assert.assertTrue(vertexIds.contains(vertex.getId()));
188 190
        }
189 191

  
190 192
        // Edges
191 193
        for (Edge edge : graph.getEdges()) {
192
            Assertions.assertTrue(edges.contains(edge));
194
            Assert.assertTrue(edges.contains(edge));
193 195

  
194 196
            Edge edgeCmp = edges.get(edges.indexOf(edge));
195
            Assertions.assertEquals(edge.getSubedgeInfo().size(), edgeCmp.getSubedgeInfo().size());
197
            Assert.assertEquals(edge.getSubedgeInfo().size(), edgeCmp.getSubedgeInfo().size());
196 198

  
197 199
            for (SubedgeInfo subedgeInfo : edge.getSubedgeInfo()) {
198
                Assertions.assertTrue(containsSubedgeWithId(subedgeInfo, edgeCmp.getSubedgeInfo()));
200
                Assert.assertTrue(containsSubedgeWithId(subedgeInfo, edgeCmp.getSubedgeInfo()));
199 201
            }
200 202
        }
201 203
    }

Také k dispozici: Unified diff