1
+ package org.utplsql.sqldev.test.runner
2
+
3
+ import org.junit.Assert
4
+ import org.junit.Before
5
+ import org.junit.Test
6
+ import org.utplsql.sqldev.model.runner.Expectation
7
+
8
+ class ExpectationTest {
9
+ var Expectation exceptionWithDescription
10
+ var Expectation exceptionWithoutDescription
11
+
12
+ @Before
13
+ def void setup () {
14
+ exceptionWithDescription = new Expectation
15
+ exceptionWithDescription. description = ' ' ' This assert must fail' ' '
16
+ exceptionWithDescription. message = ' ' ' at: 1 (number) was expected to equal: 2 (number)' ' '
17
+ exceptionWithDescription. caller = ' ' ' "SCOTT.JUNIT_UTPLSQL_TEST1_PKG.TEST_2_NOK", line 14 ut.expect(1, ' This assert must fail' ).to_equal(2);' ' '
18
+ exceptionWithoutDescription = new Expectation
19
+ exceptionWithoutDescription. message = exceptionWithDescription. message
20
+ exceptionWithoutDescription. caller = exceptionWithDescription. caller
21
+ exceptionWithoutDescription. message = ' ' ' at: 1 (number) was expected to equal: 2 (number)' ' '
22
+ exceptionWithoutDescription. caller = ' ' ' "SCOTT.JUNIT_UTPLSQL_TEST1_PKG.TEST_3_NOK", line 42 ut.expect(1).to_equal(2);' ' '
23
+ }
24
+
25
+ @Test
26
+ def void failedExpectationCallerLine () {
27
+ val actual = exceptionWithDescription. callerLine
28
+ val expected = new Integer (14 )
29
+ Assert . assertEquals(expected, actual)
30
+ }
31
+
32
+ @Test
33
+ def void shortFailureTextWithDescription () {
34
+ val actual = exceptionWithDescription. shortFailureText
35
+ val expected = ' This assert must fail (line 14)'
36
+ Assert . assertEquals(expected, actual)
37
+ }
38
+
39
+ @Test
40
+ def void shortFailureTextWithoutDescription () {
41
+ val actual = exceptionWithoutDescription. shortFailureText
42
+ val expected = ' Line 42'
43
+ Assert . assertEquals(expected, actual)
44
+ }
45
+
46
+ }
0 commit comments