File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
samples/msk-firehose-event-handler/src/test/java/example Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ package example ;
2
+
3
+ import com .amazonaws .services .lambda .runtime .Context ;
4
+ import com .amazonaws .services .lambda .runtime .tests .annotations .Event ;
5
+ import com .amazonaws .services .lambda .runtime .events .MSKFirehoseEvent ;
6
+ import com .amazonaws .services .lambda .runtime .events .MSKFirehoseResponse ;
7
+ import org .junit .jupiter .api .Assertions ;
8
+ import org .junit .jupiter .params .ParameterizedTest ;
9
+
10
+ import static java .nio .charset .StandardCharsets .UTF_8 ;
11
+
12
+ public class MSKFirehoseEventHandlerTest {
13
+
14
+ private Context context ; // intentionally null as it's not used in the test
15
+
16
+ @ ParameterizedTest
17
+ @ Event (value = "event.json" , type = MSKFirehoseEvent .class )
18
+ public void testEventHandler (MSKFirehoseEvent event ) {
19
+ Sample Sample = new Sample ();
20
+ MSKFirehoseResponse response = Sample .handleRequest (event , context );
21
+
22
+ String expectedString = "{\" Name\" :\" Hello World\" }" ;
23
+ MSKFirehoseResponse .Record firstRecord = response .getRecords ().get (0 );
24
+ Assertions .assertEquals (expectedString , UTF_8 .decode (firstRecord .getKafkaRecordValue ()).toString ());
25
+ Assertions .assertEquals (MSKFirehoseResponse .Result .Ok , firstRecord .getResult ());
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments