From fd2510c3f2a7f8179bf90883e482880be594d384 Mon Sep 17 00:00:00 2001 From: Henry Harris Date: Mon, 30 Jun 2025 15:08:43 -0700 Subject: [PATCH 1/4] add endpoint service exception test util --- .../java/api/testing/AssertableArgs.java | 56 ++++++++++ .../conjure/java/api/testing/Assertions.java | 12 +++ .../EndpointServiceExceptionAssert.java | 100 ++++++++++++++++++ .../api/testing/ServiceExceptionAssert.java | 54 +++------- .../java/api/testing/AssertionsTest.java | 29 +++++ .../EndpointServiceExceptionAssertTest.java | 98 +++++++++++++++++ 6 files changed, 307 insertions(+), 42 deletions(-) create mode 100644 test-utils/src/main/java/com/palantir/conjure/java/api/testing/AssertableArgs.java create mode 100644 test-utils/src/main/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssert.java create mode 100644 test-utils/src/test/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssertTest.java diff --git a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/AssertableArgs.java b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/AssertableArgs.java new file mode 100644 index 000000000..7556e4d55 --- /dev/null +++ b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/AssertableArgs.java @@ -0,0 +1,56 @@ +/* + * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.palantir.conjure.java.api.testing; + +import com.palantir.logsafe.Arg; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Utility to collect safe and unsafe arguments into separate collections and assert unique entries in each. + */ +record AssertableArgs(Map safeArgs, Map unsafeArgs) { + + AssertableArgs(List> args) { + this(new HashMap<>(), new HashMap<>()); + + args.forEach(arg -> { + if (arg.isSafeForLogging()) { + assertPutSafe(arg); + } else { + assertPutUnsafe(arg); + } + }); + } + + private void assertPutSafe(Arg arg) { + assertPut(safeArgs, arg.getName(), arg.getValue(), "safe"); + } + + private void assertPutUnsafe(Arg arg) { + assertPut(unsafeArgs, arg.getName(), arg.getValue(), "unsafe"); + } + + private static void assertPut(Map map, String key, Object value, String name) { + Object previous = map.put(key, value); + if (previous != null) { + throw new AssertionError(String.format( + "Duplicate %s arg name '%s', first value: %s, second value: %s", name, key, previous, value)); + } + } +} diff --git a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/Assertions.java b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/Assertions.java index 420500425..fbc367c50 100644 --- a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/Assertions.java +++ b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/Assertions.java @@ -16,6 +16,7 @@ package com.palantir.conjure.java.api.testing; +import com.palantir.conjure.java.api.errors.EndpointServiceException; import com.palantir.conjure.java.api.errors.QosException; import com.palantir.conjure.java.api.errors.RemoteException; import com.palantir.conjure.java.api.errors.ServiceException; @@ -40,6 +41,10 @@ public static QosExceptionAssert assertThat(QosException actual) { return new QosExceptionAssert(actual); } + public static EndpointServiceExceptionAssert assertThat(EndpointServiceException actual) { + return new EndpointServiceExceptionAssert(actual); + } + @CanIgnoreReturnValue public static ServiceExceptionAssert assertThatServiceExceptionThrownBy(ThrowingCallable shouldRaiseThrowable) { return assertThatThrownBy(shouldRaiseThrowable).asInstanceOf(ServiceExceptionAssert.instanceOfAssertFactory()); @@ -54,4 +59,11 @@ public static RemoteExceptionAssert assertThatRemoteExceptionThrownBy(ThrowingCa public static QosExceptionAssert assertThatQosExceptionThrownBy(ThrowingCallable shouldRaiseThrowable) { return assertThatThrownBy(shouldRaiseThrowable).asInstanceOf(QosExceptionAssert.instanceOfAssertFactory()); } + + @CanIgnoreReturnValue + public static EndpointServiceExceptionAssert assertThatEndpointServiceExceptionThrownBy( + ThrowingCallable shouldRaiseThrowable) { + return assertThatThrownBy(shouldRaiseThrowable) + .asInstanceOf(EndpointServiceExceptionAssert.instanceOfAssertFactory()); + } } diff --git a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssert.java b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssert.java new file mode 100644 index 000000000..bea05287d --- /dev/null +++ b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssert.java @@ -0,0 +1,100 @@ +package com.palantir.conjure.java.api.testing; + +import com.palantir.conjure.java.api.errors.EndpointServiceException; +import com.palantir.conjure.java.api.errors.ErrorType; +import com.palantir.logsafe.Arg; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.assertj.core.api.AbstractThrowableAssert; +import org.assertj.core.api.InstanceOfAssertFactory; +import org.assertj.core.util.Throwables; + +public class EndpointServiceExceptionAssert + extends AbstractThrowableAssert { + + private static final InstanceOfAssertFactory + INSTANCE_OF_ASSERT_FACTORY = + new InstanceOfAssertFactory<>(EndpointServiceException.class, EndpointServiceExceptionAssert::new); + + EndpointServiceExceptionAssert(EndpointServiceException actual) { + super(actual, EndpointServiceExceptionAssert.class); + } + + public static InstanceOfAssertFactory + instanceOfAssertFactory() { + return INSTANCE_OF_ASSERT_FACTORY; + } + + public final EndpointServiceExceptionAssert hasCode(ErrorType.Code code) { + isNotNull(); + failIfNotEqual( + "Expected ErrorType.Code to be %s, but found %s", + code, actual.getErrorType().code()); + return this; + } + + public final EndpointServiceExceptionAssert hasType(ErrorType type) { + isNotNull(); + failIfNotEqual("Expected ErrorType to be %s, but found %s", type, actual.getErrorType()); + return this; + } + + public final EndpointServiceExceptionAssert hasArgs(Arg... args) { + isNotNull(); + + AssertableArgs actualArgs = new AssertableArgs(actual.getArgs()); + AssertableArgs expectedArgs = new AssertableArgs(Arrays.asList(args)); + + failIfNotEqual("Expected safe args to be %s, but found %s", expectedArgs.safeArgs(), actualArgs.safeArgs()); + failIfNotEqual( + "Expected unsafe args to be %s, but found %s", expectedArgs.unsafeArgs(), actualArgs.unsafeArgs()); + + return this; + } + + public final EndpointServiceExceptionAssert hasNoArgs() { + isNotNull(); + + AssertableArgs actualArgs = new AssertableArgs(actual.getArgs()); + if (!actualArgs.safeArgs().isEmpty() || !actualArgs.unsafeArgs().isEmpty()) { + Map allArgs = new HashMap<>(); + allArgs.putAll(actualArgs.safeArgs()); + allArgs.putAll(actualArgs.unsafeArgs()); + failWithMessage( + "Expected no args, but found %s; service exception: %s", allArgs, Throwables.getStackTrace(actual)); + } + + return this; + } + + private void failIfNotEqual(String message, T expectedValue, T actualValue) { + if (!Objects.equals(expectedValue, actualValue)) { + failWithMessage( + message + "; service exception: ", expectedValue, actualValue, Throwables.getStackTrace(actual)); + } + } + + public final EndpointServiceExceptionAssert containsArgs(Arg... args) { + isNotNull(); + + AssertableArgs actualArgs = new AssertableArgs(actual.getArgs()); + AssertableArgs expectedArgs = new AssertableArgs(Arrays.asList(args)); + + failIfDoesNotContain( + "Expected safe args to contain %s, but found %s", expectedArgs.safeArgs(), actualArgs.safeArgs()); + failIfDoesNotContain( + "Expected unsafe args to contain %s, but found %s", expectedArgs.unsafeArgs(), actualArgs.unsafeArgs()); + + return this; + } + + private void failIfDoesNotContain( + String message, Map expectedArgs, Map actualArgs) { + if (!actualArgs.entrySet().containsAll(expectedArgs.entrySet())) { + failWithMessage( + message + "; service exception: %s", expectedArgs, actualArgs, Throwables.getStackTrace(actual)); + } + } +} diff --git a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/ServiceExceptionAssert.java b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/ServiceExceptionAssert.java index d2366f28d..3bbb6f665 100644 --- a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/ServiceExceptionAssert.java +++ b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/ServiceExceptionAssert.java @@ -19,14 +19,14 @@ import com.palantir.conjure.java.api.errors.ErrorType; import com.palantir.conjure.java.api.errors.ServiceException; import com.palantir.logsafe.Arg; +import org.assertj.core.api.AbstractThrowableAssert; +import org.assertj.core.api.InstanceOfAssertFactory; +import org.assertj.core.util.Throwables; + import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; -import org.assertj.core.api.AbstractThrowableAssert; -import org.assertj.core.api.InstanceOfAssertFactory; -import org.assertj.core.util.Throwables; public class ServiceExceptionAssert extends AbstractThrowableAssert { @@ -61,8 +61,9 @@ public final ServiceExceptionAssert hasArgs(Arg... args) { AssertableArgs actualArgs = new AssertableArgs(actual.getArgs()); AssertableArgs expectedArgs = new AssertableArgs(Arrays.asList(args)); - failIfNotEqual("Expected safe args to be %s, but found %s", expectedArgs.safeArgs, actualArgs.safeArgs); - failIfNotEqual("Expected unsafe args to be %s, but found %s", expectedArgs.unsafeArgs, actualArgs.unsafeArgs); + failIfNotEqual("Expected safe args to be %s, but found %s", expectedArgs.safeArgs(), actualArgs.safeArgs()); + failIfNotEqual( + "Expected unsafe args to be %s, but found %s", expectedArgs.unsafeArgs(), actualArgs.unsafeArgs()); return this; } @@ -71,10 +72,10 @@ public final ServiceExceptionAssert hasNoArgs() { isNotNull(); AssertableArgs actualArgs = new AssertableArgs(actual.getArgs()); - if (!actualArgs.safeArgs.isEmpty() || !actualArgs.unsafeArgs.isEmpty()) { + if (!actualArgs.safeArgs().isEmpty() || !actualArgs.unsafeArgs().isEmpty()) { Map allArgs = new HashMap<>(); - allArgs.putAll(actualArgs.safeArgs); - allArgs.putAll(actualArgs.unsafeArgs); + allArgs.putAll(actualArgs.safeArgs()); + allArgs.putAll(actualArgs.unsafeArgs()); failWithMessage( "Expected no args, but found %s; service exception: %s", allArgs, Throwables.getStackTrace(actual)); } @@ -96,9 +97,9 @@ public final ServiceExceptionAssert containsArgs(Arg... args) { AssertableArgs expectedArgs = new AssertableArgs(Arrays.asList(args)); failIfDoesNotContain( - "Expected safe args to contain %s, but found %s", expectedArgs.safeArgs, actualArgs.safeArgs); + "Expected safe args to contain %s, but found %s", expectedArgs.safeArgs(), actualArgs.safeArgs()); failIfDoesNotContain( - "Expected unsafe args to contain %s, but found %s", expectedArgs.unsafeArgs, actualArgs.unsafeArgs); + "Expected unsafe args to contain %s, but found %s", expectedArgs.unsafeArgs(), actualArgs.unsafeArgs()); return this; } @@ -110,35 +111,4 @@ private void failIfDoesNotContain( message + "; service exception: %s", expectedArgs, actualArgs, Throwables.getStackTrace(actual)); } } - - private static final class AssertableArgs { - private final Map safeArgs = new HashMap<>(); - private final Map unsafeArgs = new HashMap<>(); - - private AssertableArgs(List> args) { - args.forEach(arg -> { - if (arg.isSafeForLogging()) { - assertPutSafe(arg); - } else { - assertPutUnsafe(arg); - } - }); - } - - private void assertPutSafe(Arg arg) { - assertPut(safeArgs, arg.getName(), arg.getValue(), "safe"); - } - - private void assertPutUnsafe(Arg arg) { - assertPut(unsafeArgs, arg.getName(), arg.getValue(), "unsafe"); - } - - private static void assertPut(Map map, String key, Object value, String name) { - Object previous = map.put(key, value); - if (previous != null) { - throw new AssertionError(String.format( - "Duplicate %s arg name '%s', first value: %s, second value: %s", name, key, previous, value)); - } - } - } } diff --git a/test-utils/src/test/java/com/palantir/conjure/java/api/testing/AssertionsTest.java b/test-utils/src/test/java/com/palantir/conjure/java/api/testing/AssertionsTest.java index dc6bca0f1..4cf9aba49 100644 --- a/test-utils/src/test/java/com/palantir/conjure/java/api/testing/AssertionsTest.java +++ b/test-utils/src/test/java/com/palantir/conjure/java/api/testing/AssertionsTest.java @@ -16,11 +16,13 @@ package com.palantir.conjure.java.api.testing; +import static com.palantir.conjure.java.api.testing.Assertions.assertThatEndpointServiceExceptionThrownBy; import static com.palantir.conjure.java.api.testing.Assertions.assertThatQosExceptionThrownBy; import static com.palantir.conjure.java.api.testing.Assertions.assertThatRemoteExceptionThrownBy; import static com.palantir.conjure.java.api.testing.Assertions.assertThatServiceExceptionThrownBy; import static com.palantir.conjure.java.api.testing.Assertions.assertThatThrownBy; +import com.palantir.conjure.java.api.errors.EndpointServiceException; import com.palantir.conjure.java.api.errors.ErrorType; import com.palantir.conjure.java.api.errors.QosException; import com.palantir.conjure.java.api.errors.QosReason; @@ -113,4 +115,31 @@ public void testAssertThatQosExceptionThrownBy_catchesQosException() { }) .hasReason(QosReason.of("reason")); } + + @Test + public void testAssertThatEndpointServiceExceptionThrownBy_failsIfNothingThrown() { + assertThatThrownBy(() -> assertThatEndpointServiceExceptionThrownBy(() -> { + // Not going to throw anything + })) + .hasMessageContaining("Expecting code to raise a throwable."); + } + + @Test + public void testAssertThatEndpointServiceExceptionThrownBy_failsIfWrongExceptionThrown() { + assertThatThrownBy(() -> assertThatEndpointServiceExceptionThrownBy(() -> { + throw new RuntimeException("My message"); + })) + .hasMessageContaining( + "com.palantir.conjure.java.api.errors.EndpointServiceException", + "java.lang.RuntimeException", + "My message"); + } + + @Test + public void testAssertThatEndpointServiceExceptionThrownBy_catchesEndpointServiceException() { + assertThatEndpointServiceExceptionThrownBy(() -> { + throw new EndpointServiceException(ErrorType.INTERNAL) {}; + }) + .hasType(ErrorType.INTERNAL); + } } diff --git a/test-utils/src/test/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssertTest.java b/test-utils/src/test/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssertTest.java new file mode 100644 index 000000000..af3ecb263 --- /dev/null +++ b/test-utils/src/test/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssertTest.java @@ -0,0 +1,98 @@ +/* + * (c) Copyright 2017 Palantir Technologies Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.palantir.conjure.java.api.testing; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import com.palantir.conjure.java.api.errors.EndpointServiceException; +import com.palantir.conjure.java.api.errors.ErrorType; +import com.palantir.conjure.java.api.errors.ServiceException; +import com.palantir.logsafe.SafeArg; +import com.palantir.logsafe.UnsafeArg; +import org.junit.jupiter.api.Test; + +public class EndpointServiceExceptionAssertTest { + + @Test + public void testSanity() { + ErrorType actualType = ErrorType.FAILED_PRECONDITION; + + Assertions.assertThat(new EndpointServiceException(actualType, SafeArg.of("a", "b"), UnsafeArg.of("c", "d")) {}) + .hasCode(actualType.code()) + .hasType(actualType) + .hasArgs(SafeArg.of("a", "b"), UnsafeArg.of("c", "d")); + + Assertions.assertThat(new EndpointServiceException(actualType, SafeArg.of("a", "b"), UnsafeArg.of("c", "d")) {}) + .hasCode(actualType.code()) + .hasType(actualType) + .hasArgs(UnsafeArg.of("c", "d"), SafeArg.of("a", "b")); // Order doesn't matter + + Assertions.assertThat(new EndpointServiceException(actualType) {}).hasNoArgs(); + + assertThatThrownBy(() -> + Assertions.assertThat(new EndpointServiceException(actualType) {}).hasCode(ErrorType.Code.INTERNAL)) + .isInstanceOf(AssertionError.class) + .hasMessageContaining( + "Expected ErrorType.Code to be %s, but found %s", ErrorType.Code.INTERNAL, actualType.code()); + + assertThatThrownBy(() -> + Assertions.assertThat(new ServiceException(actualType)).hasType(ErrorType.INTERNAL)) + .isInstanceOf(AssertionError.class) + .hasMessageContaining("Expected ErrorType to be %s, but found %s", ErrorType.INTERNAL, actualType); + + assertThatThrownBy(() -> Assertions.assertThat(new ServiceException(actualType, SafeArg.of("a", "b"))) + .hasArgs(SafeArg.of("c", "d"))) + .isInstanceOf(AssertionError.class) + .hasMessageContaining("Expected safe args to be {c=d}, but found {a=b}"); + + assertThatThrownBy(() -> Assertions.assertThat(new ServiceException(actualType, UnsafeArg.of("a", "b"))) + .hasArgs(UnsafeArg.of("c", "d"))) + .isInstanceOf(AssertionError.class) + .hasMessageContaining("Expected unsafe args to be {c=d}, but found {a=b}"); + + assertThatThrownBy(() -> Assertions.assertThat(new ServiceException(actualType, SafeArg.of("a", "b"))) + .hasNoArgs()) + .isInstanceOf(AssertionError.class) + .hasMessageContaining("Expected no args, but found {a=b}"); + + assertThatThrownBy(() -> Assertions.assertThat( + new ServiceException(actualType, SafeArg.of("a", "b"), UnsafeArg.of("c", "d"))) + .hasNoArgs()) + .isInstanceOf(AssertionError.class) + .hasMessageContaining("Expected no args, but found {a=b, c=d}"); + + Assertions.assertThat(new ServiceException(actualType, UnsafeArg.of("a", "b"), UnsafeArg.of("c", "d"))) + .containsArgs(UnsafeArg.of("a", "b")); + + // Safety matters + assertThatThrownBy(() -> Assertions.assertThat( + new ServiceException(actualType, SafeArg.of("a", "b"), UnsafeArg.of("c", "d"))) + .containsArgs(UnsafeArg.of("a", "b"))) + .isInstanceOf(AssertionError.class) + .hasMessageContaining("Expected unsafe args to contain {a=b}, but found {c=d}"); + + assertThatThrownBy(() -> Assertions.assertThat(new ServiceException(actualType, SafeArg.of("a", "b"))) + .containsArgs(SafeArg.of("c", "d"))) + .isInstanceOf(AssertionError.class) + .hasMessageContaining("Expected safe args to contain {c=d}, but found {a=b}"); + + assertThatThrownBy(() -> Assertions.assertThat(new ServiceException(actualType, UnsafeArg.of("a", "b"))) + .containsArgs(UnsafeArg.of("c", "d"))) + .isInstanceOf(AssertionError.class) + .hasMessageContaining("Expected unsafe args to contain {c=d}, but found {a=b}"); + } +} From 1b28876a0600faaa8b4c4be8d3bab795a3801497 Mon Sep 17 00:00:00 2001 From: svc-changelog Date: Mon, 30 Jun 2025 22:17:22 +0000 Subject: [PATCH 2/4] Add generated changelog entries --- changelog/@unreleased/pr-1366.v2.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/@unreleased/pr-1366.v2.yml diff --git a/changelog/@unreleased/pr-1366.v2.yml b/changelog/@unreleased/pr-1366.v2.yml new file mode 100644 index 000000000..1786e488c --- /dev/null +++ b/changelog/@unreleased/pr-1366.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Add endpoint service exception test util + links: + - https://github.com/palantir/conjure-java-runtime-api/pull/1366 From b713792e684043e06ed2724d31ad0173208df312 Mon Sep 17 00:00:00 2001 From: Henry Harris Date: Mon, 30 Jun 2025 15:19:17 -0700 Subject: [PATCH 3/4] header --- .../testing/EndpointServiceExceptionAssert.java | 16 ++++++++++++++++ .../EndpointServiceExceptionAssertTest.java | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssert.java b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssert.java index bea05287d..1fc3d5ad6 100644 --- a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssert.java +++ b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssert.java @@ -1,3 +1,19 @@ +/* + * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.palantir.conjure.java.api.testing; import com.palantir.conjure.java.api.errors.EndpointServiceException; diff --git a/test-utils/src/test/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssertTest.java b/test-utils/src/test/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssertTest.java index af3ecb263..353c24643 100644 --- a/test-utils/src/test/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssertTest.java +++ b/test-utils/src/test/java/com/palantir/conjure/java/api/testing/EndpointServiceExceptionAssertTest.java @@ -1,5 +1,5 @@ /* - * (c) Copyright 2017 Palantir Technologies Inc. All rights reserved. + * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,8 +43,8 @@ public void testSanity() { Assertions.assertThat(new EndpointServiceException(actualType) {}).hasNoArgs(); - assertThatThrownBy(() -> - Assertions.assertThat(new EndpointServiceException(actualType) {}).hasCode(ErrorType.Code.INTERNAL)) + assertThatThrownBy(() -> Assertions.assertThat(new EndpointServiceException(actualType) {}) + .hasCode(ErrorType.Code.INTERNAL)) .isInstanceOf(AssertionError.class) .hasMessageContaining( "Expected ErrorType.Code to be %s, but found %s", ErrorType.Code.INTERNAL, actualType.code()); From 9d94e6f99f0e32bfced97fc54db00d1e07b61f32 Mon Sep 17 00:00:00 2001 From: Henry Harris Date: Mon, 30 Jun 2025 15:21:01 -0700 Subject: [PATCH 4/4] gw spotlessApply --- .../conjure/java/api/testing/ServiceExceptionAssert.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/ServiceExceptionAssert.java b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/ServiceExceptionAssert.java index 3bbb6f665..29df959a0 100644 --- a/test-utils/src/main/java/com/palantir/conjure/java/api/testing/ServiceExceptionAssert.java +++ b/test-utils/src/main/java/com/palantir/conjure/java/api/testing/ServiceExceptionAssert.java @@ -19,14 +19,13 @@ import com.palantir.conjure.java.api.errors.ErrorType; import com.palantir.conjure.java.api.errors.ServiceException; import com.palantir.logsafe.Arg; -import org.assertj.core.api.AbstractThrowableAssert; -import org.assertj.core.api.InstanceOfAssertFactory; -import org.assertj.core.util.Throwables; - import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import org.assertj.core.api.AbstractThrowableAssert; +import org.assertj.core.api.InstanceOfAssertFactory; +import org.assertj.core.util.Throwables; public class ServiceExceptionAssert extends AbstractThrowableAssert {