More examples testing.

This commit is contained in:
Erik C. Thauvin 2018-07-03 19:24:30 -07:00
parent c7d46bfd7a
commit f4f0ce42ae
12 changed files with 50 additions and 38 deletions

View file

@ -1,12 +1,21 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
public class App {
public String getGreeting() {
return "Hello world.";
public static void main(String[] args) {
new App().cat(args[0]);
}
public static void main(String[] args) {
System.out.println(new App().getGreeting());
public void cat(String name) {
try {
final List<String> content = Files.readAllLines(Paths.get(name));
for (String line : content) {
if (!line.startsWith("#")) System.out.println(line);
}
} catch (IOException e) {
System.out.println(e);
}
}
}
}

View file

@ -1,11 +1,14 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
import org.junit.Test;
import static org.junit.Assert.*;
public class AppTest {
@Test public void testAppHasAGreeting() {
@Test
public void testAppHasAGreeting() {
App classUnderTest = new App();
assertNotNull("app should have a greeting", classUnderTest.getGreeting());
}