-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix t8n encoding issue #5936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix t8n encoding issue #5936
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9a98755
Fix t8n encoding issue
shemnon fa9a7eb
Merge branch 'main' of github.com:hyperledger/besu into 5910-no-contr…
shemnon 31baed1
remove system.out and changelong
shemnon e1bebf3
Merge branch 'main' into 5910-no-control-characters
shemnon 67dabfd
Update ethereum/evmtool/src/test/java/org/hyperledger/besu/evmtool/T8…
shemnon dd6d332
Merge branch 'main' into 5910-no-control-characters
shemnon f2cbec0
Merge branch 'main' of github.com:hyperledger/besu into 5910-no-contr…
shemnon ba821ec
spotless
shemnon b7b4e25
spdx
shemnon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
ethereum/evmtool/src/test/java/org/hyperledger/besu/evmtool/T8nServerSubCommandTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package org.hyperledger.besu.evmtool; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.mockito.Mockito.verify; | ||
| import static org.mockito.Mockito.when; | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import io.vertx.core.http.HttpServerRequest; | ||
| import io.vertx.core.http.HttpServerResponse; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.extension.ExtendWith; | ||
| import org.mockito.Answers; | ||
| import org.mockito.ArgumentCaptor; | ||
| import org.mockito.Mock; | ||
| import org.mockito.junit.jupiter.MockitoExtension; | ||
|
|
||
| @ExtendWith(MockitoExtension.class) | ||
| class T8nServerSubCommandTest { | ||
|
|
||
| @Mock HttpServerRequest httpServerRequest; | ||
|
|
||
| @Mock(answer = Answers.RETURNS_SELF) | ||
| HttpServerResponse httpServerResponse; | ||
|
|
||
| @Test | ||
| void exceptionEncodedProperlyInJSON() { | ||
| T8nServerSubCommand subject = new T8nServerSubCommand(); | ||
| ObjectMapper objectMapper = new ObjectMapper(); | ||
|
|
||
| when(httpServerRequest.response()).thenReturn(httpServerResponse); | ||
|
|
||
| // Should trigger a NPE within the try block. | ||
| subject.handleT8nRequest(httpServerRequest, objectMapper, null, null); | ||
|
|
||
| ArgumentCaptor<Integer> responseCodeCaptor = ArgumentCaptor.forClass(Integer.class); | ||
| ArgumentCaptor<String> responseStringCaptor = ArgumentCaptor.forClass(String.class); | ||
|
|
||
| verify(httpServerResponse).setStatusCode(responseCodeCaptor.capture()); | ||
| verify(httpServerResponse).end(responseStringCaptor.capture()); | ||
|
|
||
| System.out.println(responseCodeCaptor.getValue()); | ||
| System.out.println(responseStringCaptor.getValue()); | ||
|
shemnon marked this conversation as resolved.
Outdated
|
||
| assertThat(responseCodeCaptor.getValue()).isEqualTo(500); | ||
| assertThat(responseStringCaptor.getValue()).doesNotContain("\\t"); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.