@@ -7,13 +7,14 @@ describe('java runner', function() {
77 it ( 'should handle basic code evaluation' , function ( done ) {
88 runner . run ( {
99 language : 'java' ,
10- code : [
11- ' class Solution {' ,
12- ' static void main(String[] args){' ,
13- ' System.out.println("42");' ,
14- ' }' ,
15- '}' ] . join ( '\n' )
10+ code :`
11+ class Solution {
12+ public static void main(String[] args){
13+ System.out.println("42");
14+ }
15+ }`
1616 } , function ( buffer ) {
17+ console . log ( buffer ) ;
1718 expect ( buffer . stdout ) . to . contain ( '42\n' ) ;
1819 done ( ) ;
1920 } ) ;
@@ -23,21 +24,21 @@ describe('java runner', function() {
2324 it ( 'should handle basic junit tests' , function ( done ) {
2425 runner . run ( {
2526 language : 'java' ,
26- code : ' public class Solution {\n'
27- + ' public Solution(){}\n'
28- + ' public int testthing(){return 3;}\n'
29- + '}\n' ,
30- fixture : ' import static org.junit.Assert.assertEquals;\n'
31- + ' import org.junit.Test;\n'
32- + ' import org.junit.runners.JUnit4;\n'
33- + ' public class TestFixture {\n'
34- + ' public TestFixture(){}'
35- + ' @Test\n'
36- + ' public void myTestFunction(){\n'
37- + ' Solution s = new Solution();\n'
38- + ' assertEquals("wow", 3, s.testthing());\n'
39- + ' System.out.println("test out");\n'
40- + '}}'
27+ code : ` public class Solution {
28+ public Solution(){}
29+ public int testthing(){return 3;}
30+ }` ,
31+ fixture : ` import static org.junit.Assert.assertEquals;
32+ import org.junit.Test;
33+ import org.junit.runners.JUnit4;
34+ public class TestFixture {
35+ public TestFixture(){}
36+ @Test
37+ public void myTestFunction(){
38+ Solution s = new Solution();
39+ assertEquals("wow", 3, s.testthing());
40+ System.out.println("test out");
41+ }}`
4142 } , function ( buffer ) {
4243 expect ( buffer . stdout ) . to . contain ( '<DESCRIBE::>myTestFunction(TestFixture)<:LF:>\ntest out\n\n<PASSED::>Test Passed<:LF:>\n' ) ;
4344 done ( ) ;
@@ -46,21 +47,21 @@ describe('java runner', function() {
4647 it ( 'should handle junit tests failing' , function ( done ) {
4748 runner . run ( {
4849 language : 'java' ,
49- code : ' public class Solution {\n'
50- + ' public Solution(){}\n'
51- + ' public int testthing(){return 3;}\n'
52- + '}\n' ,
53- fixture : ' import static org.junit.Assert.assertEquals;\n'
54- + ' import org.junit.Test;\n'
55- + ' import org.junit.runners.JUnit4;\n'
56- + ' public class TestFixture {\n'
57- + ' public TestFixture(){}'
58- + ' @Test\n'
59- + ' public void myTestFunction(){\n'
60- + ' Solution s = new Solution();\n'
61- + ' assertEquals("Failed Message", 5, s.testthing());\n'
62- + ' System.out.println("test out");\n'
63- + '}}'
50+ code : ` public class Solution {
51+ public Solution(){}
52+ public int testthing(){return 3;}
53+ }` ,
54+ fixture : ` import static org.junit.Assert.assertEquals;
55+ import org.junit.Test;
56+ import org.junit.runners.JUnit4;
57+ public class TestFixture {
58+ public TestFixture(){}
59+ @Test
60+ public void myTestFunction(){
61+ Solution s = new Solution();
62+ assertEquals("Failed Message", 5, s.testthing());
63+ System.out.println("test out");
64+ }}`
6465 } , function ( buffer ) {
6566 expect ( buffer . stdout ) . to . contain ( '<DESCRIBE::>myTestFunction(TestFixture)<:LF:>\n\n<FAILED::>Failed Message expected:<5> but was:<3><:LF:>\n' ) ;
6667 done ( ) ;
@@ -69,19 +70,19 @@ describe('java runner', function() {
6970 it ( 'should report junit messages' , function ( done ) {
7071 runner . run ( {
7172 language : 'java' ,
72- code : ' public class Solution {\n'
73- + ' public Solution(){}\n'
74- + ' public String testthing(){ return null; }\n'
75- + '}\n' ,
76- fixture : ' import static org.junit.Assert.assertEquals;\n'
77- + ' import org.junit.Test;\n'
78- + ' import org.junit.runners.JUnit4;\n'
79- + ' public class TestFixture {\n'
80- + ' @Test\n'
81- + ' public void myTestFunction(){\n'
82- + ' Solution s = new Solution();\n'
83- + ' assertEquals("Failed Message", 1, s.testthing().length());\n'
84- + '}}'
73+ code : ` public class Solution {
74+ public Solution(){}
75+ public String testthing(){ return null; }
76+ }` ,
77+ fixture : ` import static org.junit.Assert.assertEquals;
78+ import org.junit.Test;
79+ import org.junit.runners.JUnit4;
80+ public class TestFixture {
81+ @Test
82+ public void myTestFunction(){
83+ Solution s = new Solution();
84+ assertEquals("Failed Message", 1, s.testthing().length());
85+ }}`
8586 } , function ( buffer ) {
8687 expect ( buffer . stdout ) . to . contain ( '<FAILED::>Runtime Error Occurred' ) ;
8788 expect ( buffer . stdout ) . to . contain ( 'NullPointerException' ) ;
0 commit comments