-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
ProblemTest.java
32 lines (24 loc) · 1016 Bytes
/
ProblemTest.java
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
package com.github.javaparser;
import org.junit.Test;
import static com.github.javaparser.Range.range;
import static com.github.javaparser.utils.TestUtils.assertInstanceOf;
import static org.junit.Assert.assertEquals;
public class ProblemTest {
@Test
public void testSimpleGetters() {
Problem problem = new Problem("Parse error", TokenRange.INVALID, new Exception());
assertEquals(TokenRange.INVALID, problem.getLocation().get());
assertEquals("Parse error", problem.getMessage());
assertInstanceOf(Exception.class, problem.getCause().get());
}
@Test
public void testVerboseMessage() {
Problem problem = new Problem("Parse error", TokenRange.INVALID, null);
assertEquals("(line ?,col ?) Parse error", problem.getVerboseMessage());
}
@Test
public void testVerboseMessageWithoutLocation() {
Problem problem = new Problem("Parse error", null, null);
assertEquals("Parse error", problem.getVerboseMessage());
}
}