Last change
on this file since 726 was 726, checked in by wouter, 13 months ago |
#248 added test showing the issue. It's in junit-t as you can only run unit tests there. Maybe this belongs to core
|
File size:
767 bytes
|
Rev | Line | |
---|
[717] | 1 | package testcode;
|
---|
| 2 |
|
---|
| 3 | import org.junit.Test;
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Test that having a @Test annotation results in the translated class to extend
|
---|
| 7 | * unittest.TestCase. We can not test this in java, therefore this class is not
|
---|
| 8 | * runnable.
|
---|
| 9 | */
|
---|
| 10 | public class SomeUnitTest {
|
---|
| 11 |
|
---|
| 12 | @Test
|
---|
| 13 | public void test1() {
|
---|
| 14 | System.out.println("java always succeeds this print");
|
---|
| 15 | }
|
---|
| 16 |
|
---|
[721] | 17 | /**
|
---|
| 18 | * This test does not have the name testXXX.java and therefore the
|
---|
| 19 | * translator must introduce a new method that does start with "test"
|
---|
| 20 | */
|
---|
| 21 | @Test
|
---|
| 22 | public void someothertest() {
|
---|
| 23 | System.out.println("also fine with java");
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | /**
|
---|
| 27 | * Translating this must result in testRaises()
|
---|
| 28 | */
|
---|
| 29 | @Test(expected = NullPointerException.class)
|
---|
| 30 | public void nullTest() {
|
---|
| 31 | Integer x = null;
|
---|
| 32 | x.toString();// throws NPE
|
---|
| 33 | }
|
---|
| 34 |
|
---|
[717] | 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.