Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package com.agorapulse;
import io.micronaut.configuration.picocli.PicocliRunner;
import io.micronaut.context.ApplicationContext;
import io.micronaut.context.env.Environment;
import java.time.Instant;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class MicronautAwsBatchDemoCommandTest {
public void testWithCommandLineOption() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos));
try (ApplicationContext ctx =, Environment.TEST)) {
String[] args = new String[] { "-t", };, ctx, args);
// micronaut-aws-batch-demo
String output = baos.toString();
assertTrue(output.contains("Event sent at 20"));
assertTrue(output.contains("to the environments [cli, test]"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment