Skip to content

Commit

Permalink
prevent abuse of mock
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian committed Sep 27, 2024
1 parent 9b3cc8d commit 4126b80
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.junit.Before;
import org.junit.Test;

import static org.mockito.Mockito.mock;

public class CommonResponseTest {
private CommonResponse response;

Expand All @@ -25,14 +23,14 @@ public void getSetTest() {
response.setHttpStatus(200);
Assert.assertEquals(200, response.getHttpStatus());

HttpResponse httpResponse = mock(HttpResponse.class);
HttpResponse httpResponse = new HttpResponse();
response.setHttpResponse(httpResponse);
Assert.assertTrue(httpResponse == response.getHttpResponse());
}

@Test
public void getInstanceTest() throws ClientException {
UnmarshallerContext context = mock(UnmarshallerContext.class);
UnmarshallerContext context = new UnmarshallerContext();
Assert.assertNull(response.getInstance(context));
}

Expand Down

0 comments on commit 4126b80

Please sign in to comment.