Created
October 12, 2021 12:26
-
-
Save musketyr/d1fd7381a37f4fef1c23c337cd0ec15b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.agorapulse; | |
import io.micronaut.configuration.picocli.PicocliRunner; | |
import io.micronaut.context.ApplicationContext; | |
import io.micronaut.context.env.Environment; | |
import java.io.ByteArrayOutputStream; | |
import java.io.PrintStream; | |
import java.time.Instant; | |
import org.junit.jupiter.api.Test; | |
import static org.junit.jupiter.api.Assertions.assertTrue; | |
public class MicronautAwsBatchDemoCommandTest { | |
@Test | |
public void testWithCommandLineOption() throws Exception { | |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
System.setOut(new PrintStream(baos)); | |
try (ApplicationContext ctx = ApplicationContext.run(Environment.CLI, Environment.TEST)) { | |
String[] args = new String[] { "-t", Instant.now().toString() }; | |
PicocliRunner.run(MicronautAwsBatchDemoCommand.class, 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