001package edu.pdx.cs.joy; 002 003import org.junit.jupiter.api.Test; 004 005import static org.hamcrest.MatcherAssert.assertThat; 006import static org.hamcrest.Matchers.containsString; 007 008public final class InvokeMainTest extends InvokeMainTestCase { 009 010 @Test 011 public void commandLineArgsWrittenToStandardOutAreCaptured() { 012 String[] args = { "One", "Two", "Three"}; 013 MainMethodResult result = invokeMain(InvokeMainTest.class, args); 014 015 String out = result.getTextWrittenToStandardOut(); 016 for(String arg : args) { 017 assertThat(out, containsString(arg)); 018 } 019 } 020 021 public static void main(String... args) { 022 for (String arg : args) { 023 System.out.println(arg); 024 } 025 } 026}