Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test system out #16

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<filteredResources>
<filter>
<id>1609413910592</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 1 addition & 1 deletion src/main/java/com/mycompany/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class App
{
public static void main( String[] args )
{
System.out.println( "Hello Remote World!" );
System.out.print( "Hello Remote World!" );
}
}
15 changes: 15 additions & 0 deletions src/test/java/com/mycompany/app/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.Test;
import static org.junit.Assert.*;
import java.io.*;


public class AppTest
Expand All @@ -20,4 +21,18 @@ public void testMore()
{
assertTrue( true );
}

@Test
public void testSystemOut()
{
PrintStream originalOut = System.out;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
System.setOut(new PrintStream(bos));

App.main(null);

assertEquals("Hello Remote World!", bos.toString());

System.setOut(originalOut);
}
}