Skip to content

Commit 68225bd

Browse files
committed
fix tests
1 parent ef712db commit 68225bd

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

powertools-cloudformation/src/test/java/software/amazon/lambda/powertools/cloudformation/CloudFormationResponseTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import software.amazon.awssdk.utils.StringInputStream;
3939
import software.amazon.lambda.powertools.cloudformation.CloudFormationResponse.ResponseBody;
4040

41-
public class CloudFormationResponseTest {
41+
class CloudFormationResponseTest {
4242

4343
/**
4444
* Creates a mock CloudFormationCustomResourceEvent with a non-null response URL.
@@ -215,7 +215,7 @@ void reasonIncludesLogStreamName() {
215215
}
216216

217217
@Test
218-
public void sendWithNoResponseData() throws Exception {
218+
void sendWithNoResponseData() throws Exception {
219219
CloudFormationCustomResourceEvent event = mockCloudFormationCustomResourceEvent();
220220
Context context = mock(Context.class);
221221
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
@@ -237,7 +237,7 @@ public void sendWithNoResponseData() throws Exception {
237237
}
238238

239239
@Test
240-
public void sendWithNonNullResponseData() throws Exception {
240+
void sendWithNonNullResponseData() throws Exception {
241241
CloudFormationCustomResourceEvent event = mockCloudFormationCustomResourceEvent();
242242
Context context = mock(Context.class);
243243
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
@@ -289,7 +289,7 @@ void responseBodyStreamSuccessResponse() throws Exception {
289289
Context context = mock(Context.class);
290290
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
291291

292-
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.success());
292+
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.success(null));
293293

294294
String expectedJson = "{" +
295295
"\"Status\":\"SUCCESS\"," +
@@ -310,7 +310,7 @@ void responseBodyStreamFailedResponse() throws Exception {
310310
Context context = mock(Context.class);
311311
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
312312

313-
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.failed());
313+
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.failed(null));
314314

315315
String expectedJson = "{" +
316316
"\"Status\":\"FAILED\"," +

powertools-cloudformation/src/test/java/software/amazon/lambda/powertools/cloudformation/ResponseTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.Map;
2323
import org.junit.jupiter.api.Test;
2424

25-
public class ResponseTest {
25+
class ResponseTest {
2626

2727
@Test
2828
void defaultValues() {
@@ -92,7 +92,7 @@ void jsonMapValueWithDefaultObjectMapper() {
9292

9393
String expected = "{\"foo\":\"bar\"}";
9494
assertThat(response.getJsonNode()).isNotNull();
95-
assertThat(response.getJsonNode().toString()).isEqualTo(expected);
95+
assertThat(response.getJsonNode()).hasToString(expected);
9696
assertThat(response.toString()).contains("JSON = " + expected);
9797
}
9898

@@ -105,7 +105,7 @@ void jsonObjectValueWithDefaultObjectMapper() {
105105
.build();
106106

107107
String expected = "{\"PropertyWithLongName\":\"test\"}";
108-
assertThat(response.getJsonNode().toString()).isEqualTo(expected);
108+
assertThat(response.getJsonNode()).hasToString(expected);
109109
assertThat(response.toString()).contains("JSON = " + expected);
110110
}
111111

@@ -119,7 +119,7 @@ void jsonObjectValueWithNullObjectMapper() {
119119
.build();
120120

121121
String expected = "{\"PropertyWithLongName\":\"test\"}";
122-
assertThat(response.getJsonNode().toString()).isEqualTo(expected);
122+
assertThat(response.getJsonNode()).hasToString(expected);
123123
assertThat(response.toString()).contains("JSON = " + expected);
124124
}
125125

@@ -135,7 +135,7 @@ void jsonObjectValueWithCustomObjectMapper() {
135135
.build();
136136

137137
String expected = "{\"property-with-long-name\":10}";
138-
assertThat(response.getJsonNode().toString()).isEqualTo(expected);
138+
assertThat(response.getJsonNode()).hasToString(expected);
139139
assertThat(response.toString()).contains("JSON = " + expected);
140140
}
141141

@@ -154,21 +154,21 @@ void jsonObjectValueWithPostConfiguredObjectMapper() {
154154
customMapper.setPropertyNamingStrategy(PropertyNamingStrategies.UPPER_CAMEL_CASE);
155155

156156
String expected = "{\"property-with-long-name\":10}";
157-
assertThat(response.getJsonNode().toString()).isEqualTo(expected);
157+
assertThat(response.getJsonNode()).hasToString(expected);
158158
assertThat(response.toString()).contains("JSON = " + expected);
159159
}
160160

161161
@Test
162162
void successFactoryMethod() {
163-
Response response = Response.success();
163+
Response response = Response.success(null);
164164

165165
assertThat(response).isNotNull();
166166
assertThat(response.getStatus()).isEqualTo(Response.Status.SUCCESS);
167167
}
168168

169169
@Test
170170
void failedFactoryMethod() {
171-
Response response = Response.failed();
171+
Response response = Response.failed(null);
172172

173173
assertThat(response).isNotNull();
174174
assertThat(response.getStatus()).isEqualTo(Response.Status.FAILED);

powertools-cloudformation/src/test/java/software/amazon/lambda/powertools/cloudformation/handlers/NoPhysicalResourceIdSetHandler.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ public class NoPhysicalResourceIdSetHandler extends AbstractCustomResourceHandle
2323

2424
@Override
2525
protected Response create(CloudFormationCustomResourceEvent event, Context context) {
26-
return Response.success();
26+
return Response.success(null);
2727
}
2828

2929
@Override
3030
protected Response update(CloudFormationCustomResourceEvent event, Context context) {
31-
return Response.success();
31+
return Response.success(null);
3232
}
3333

3434
@Override
3535
protected Response delete(CloudFormationCustomResourceEvent event, Context context) {
36-
return Response.success();
36+
return Response.success(null);
3737
}
3838
}

0 commit comments

Comments
 (0)