Skip to content

Instantly share code, notes, and snippets.

@recursivecodes
Created August 12, 2019 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save recursivecodes/876570b1b3f46eb4ad9f7a79afee5d05 to your computer and use it in GitHub Desktop.
Save recursivecodes/876570b1b3f46eb4ad9f7a79afee5d05 to your computer and use it in GitHub Desktop.
HelloFunctionTest.java
package com.example.fn;
import com.fnproject.fn.testing.*;
import org.junit.*;
import static org.junit.Assert.*;
public class HelloFunctionTest {
    @Rule
    public final FnTestingRule testing = FnTestingRule.createDefault();
    @Test
    public void shouldReturnGreeting() {
        String event = "[your test image event JSON]";
        testing.givenEvent().withBody(event).enqueue();
        testing.thenRun(HelloFunction.class, "handleRequest");
        FnResult result = testing.getOnlyResult();
        assertTrue(result.isSuccess());
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment