Skip to content
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

Excavator: Upgrades Baseline to the latest version #1542

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.5.0'
classpath 'com.palantir.gradle.conjure:gradle-conjure:4.27.2'
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.6.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.38.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.40.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.0.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.3'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.6.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.palantir.logsafe.UnsafeArg;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.Test;

public final class SerializableErrorTest {
Expand All @@ -36,7 +37,7 @@ public void serializationSanity() throws IOException {
new ServiceException(ErrorType.INVALID_ARGUMENT, SafeArg.of("foo", 42), UnsafeArg.of("bar", "boom")));
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Encodings.json().serializer(new TypeMarker<SerializableError>() {}).serialize(error, stream);
assertThat(stream.toString())
assertThat(stream.toString(StandardCharsets.UTF_8))
.isEqualTo("{\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"Default:InvalidArgument\","
+ "\"errorInstanceId\":\""
+ error.errorInstanceId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand Down Expand Up @@ -97,7 +98,7 @@ public void handlesRemoteException() throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Encodings.json().serializer(new TypeMarker<SerializableError>() {}).serialize(expectedPropagatedError, stream);

assertThat(response.body().string()).isEqualTo(stream.toString());
assertThat(response.body().string()).isEqualTo(stream.toString(StandardCharsets.UTF_8));
// remote exceptions should result in 500 status
assertThat(response.code()).isEqualTo(ErrorType.INTERNAL.httpErrorCode());
}
Expand All @@ -119,7 +120,7 @@ public void handles401RemoteException() throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Encodings.json().serializer(new TypeMarker<SerializableError>() {}).serialize(expectedPropagatedError, stream);

assertThat(response.body().string()).isEqualTo(stream.toString());
assertThat(response.body().string()).isEqualTo(stream.toString(StandardCharsets.UTF_8));
assertThat(response.code()).isEqualTo(ErrorType.UNAUTHORIZED.httpErrorCode());
}

Expand All @@ -140,7 +141,7 @@ public void handles403RemoteException() throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Encodings.json().serializer(new TypeMarker<SerializableError>() {}).serialize(expectedPropagatedError, stream);

assertThat(response.body().string()).isEqualTo(stream.toString());
assertThat(response.body().string()).isEqualTo(stream.toString(StandardCharsets.UTF_8));
assertThat(response.code()).isEqualTo(ErrorType.PERMISSION_DENIED.httpErrorCode());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
Expand Down Expand Up @@ -172,7 +173,7 @@ public void generatesCode() throws Exception {
CommandLine.run(new ConjureJavaCli(), recordingStream, args);
assertThat(new File(tempDir, "com/palantir/conjure/spec/ConjureDefinition.java").isFile())
.isTrue();
assertThat(baos.toString()).doesNotContain("[WARNING] Using deprecated ByteBuffer");
assertThat(baos.toString(StandardCharsets.UTF_8)).doesNotContain("[WARNING] Using deprecated ByteBuffer");
}

@Test
Expand Down