From 83ff1fffa1c256256016a30f557650f781cfe8e9 Mon Sep 17 00:00:00 2001 From: Luke Young <91491244+lyoung-confluent@users.noreply.github.com> Date: Wed, 24 Jan 2024 22:39:49 -0800 Subject: [PATCH] Update s3_batch_job_test.go --- events/s3_batch_job_test.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/events/s3_batch_job_test.go b/events/s3_batch_job_test.go index 802d38b2..fd14ddd4 100644 --- a/events/s3_batch_job_test.go +++ b/events/s3_batch_job_test.go @@ -10,10 +10,30 @@ import ( "github.com/stretchr/testify/assert" ) -func TestS3BatchJobEventMarshaling(t *testing.T) { +func TestS3BatchJobEventMarshalingSchema1(t *testing.T) { // 1. read JSON from file - inputJSON := test.ReadJSONFromFile(t, "./testdata/s3-batch-job-event-request.json") + inputJSON := test.ReadJSONFromFile(t, "./testdata/s3-batch-job-event-request-1.0.json") + + // 2. de-serialize into Go object + var inputEvent S3BatchJobEvent + if err := json.Unmarshal(inputJSON, &inputEvent); err != nil { + t.Errorf("could not unmarshal event. details: %v", err) + } + + // 3. serialize to JSON + outputJSON, err := json.Marshal(inputEvent) + if err != nil { + t.Errorf("could not marshal event. details: %v", err) + } + + // 4. check result + assert.JSONEq(t, string(inputJSON), string(outputJSON)) +} + +func TestS3BatchJobEventMarshalingSchema2(t *testing.T) { + // 1. read JSON from file + inputJSON := test.ReadJSONFromFile(t, "./testdata/s3-batch-job-event-request-2.0.json") // 2. de-serialize into Go object var inputEvent S3BatchJobEvent