AbstractGraphSearchTest.java
1.11 KB
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 org.onlab.graph;
import com.google.common.collect.ImmutableSet;
import org.junit.Test;
/**
* Base for all graph search tests.
*/
public abstract class AbstractGraphSearchTest extends GraphTest {
/**
* Creates a graph search to be tested.
*
* @return graph search
*/
protected abstract GraphPathSearch<TestVertex, TestEdge> graphSearch();
@Test(expected = IllegalArgumentException.class)
public void badSource() {
graphSearch().search(new AdjacencyListsGraph<>(ImmutableSet.of(B, C),
ImmutableSet.of(new TestEdge(B, C, 1))),
A, H, weight);
}
@Test(expected = NullPointerException.class)
public void nullSource() {
graphSearch().search(new AdjacencyListsGraph<>(ImmutableSet.of(B, C),
ImmutableSet.of(new TestEdge(B, C, 1))),
null, H, weight);
}
@Test(expected = NullPointerException.class)
public void nullGraph() {
graphSearch().search(null, A, H, weight);
}
}