Skip to content

Commit a26d4ae

Browse files
committed
Merge branch 'develop' of github.com:redomar/JavaGame into develop
2 parents f0fecca + f4d86b8 commit a26d4ae

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ sourceSets.main.resources.srcDirs 'res'
1010
dependencies{
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

src/com/redomar/game/script/PrintToLog.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}

0 commit comments

Comments
 (0)