File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
src/com/redomar/game/script
test/com/redomar/game/script Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ sourceSets.main.resources.srcDirs 'res'
1010dependencies {
1111 compile ' org.apache.commons:commons-lang3:3.4'
1212 compile ' javazoom:jlayer:1.0.1'
13+ compile ' junit:junit:4.12'
1314 compile files(' res/jars/JSplashScreen.jar' )
1415}
1516
Original file line number Diff line number Diff line change @@ -24,7 +24,12 @@ private void initiate() {
2424 try {
2525 printer = new PrintWriter (new FileOutputStream (url , true ));
2626 } catch (FileNotFoundException e ) {
27+ //throw new FileNotFoundException();
2728 System .err .println (e );
2829 }
2930 }
31+
32+ public File getUrl (){
33+ return this .url ;
34+ }
3035}
Original file line number Diff line number Diff line change 1+ package com .redomar .game .script ;
2+
3+ import org .junit .Test ;
4+
5+ import static org .junit .Assert .assertTrue ;
6+
7+ /**
8+ * Created by Mohamed on 23/08/2016.
9+ *
10+ * This file tests the com.redomar.game.script.PrintToLog class
11+ */
12+ public class PrintToLogTest {
13+
14+ PrintToLog print ;
15+
16+ @ Test (expected = NullPointerException .class )
17+ public void PrintToLogNullFile () {
18+ print = new PrintToLog (null );
19+ }
20+
21+ @ Test
22+ public void PrintToLogDoesWork () {
23+ print = new PrintToLog (".Test.txt" );
24+ assertTrue (print .getUrl ().exists ());
25+ print .getUrl ().delete ();
26+ }
27+
28+ }
You can’t perform that action at this time.
0 commit comments