Skip to content

Excavator: Prefer AssertJ #22

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dependencies {
implementation 'com.palantir.safe-logging:preconditions'

testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.assertj:assertj-core'
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.palantir.computemodules;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
Expand Down Expand Up @@ -54,23 +54,23 @@ void test_example_compute_module() {
Integer result3 = testClient.result(job3, Integer.class);
String result1 = testClient.result(job1, String.class);

assertEquals(result1, "hello Compute Module");
assertEquals(result2, 4);
assertEquals(result3, 20);
assertThat("hello Compute Module").isEqualTo(result1);
assertThat(4).isEqualTo(result2);
assertThat(20).isEqualTo(result3);
}

@Test
void test_invalid_function_name() throws IOException {
InputStream result = testClient.execute("doesn't exist", 2);
String error = new String(result.readAllBytes(), StandardCharsets.UTF_8);
assertEquals(error.contains("Requested function not found"), true);
assertThat(true).isEqualTo(error.contains("Requested function not found"));
}

@Test
void test_user_function_that_throws() throws IOException {
InputStream result = testClient.execute("error", 2);
String error = new String(result.readAllBytes(), StandardCharsets.UTF_8);
assertEquals(error.contains("Intentionally throwing: 2"), true);
assertThat(true).isEqualTo(error.contains("Intentionally throwing: 2"));
}

static Integer dub(Context context, Integer input) {
Expand Down
3 changes: 2 additions & 1 deletion versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ com.palantir.safe-logging:logger-slf4j:3.7.0 (1 constraints: 050e6842)
com.palantir.safe-logging:logger-spi:3.7.0 (2 constraints: 191ea27b)
com.palantir.safe-logging:preconditions:3.7.0 (1 constraints: 0c050f36)
com.palantir.safe-logging:safe-logging:3.7.0 (3 constraints: 872e9986)
net.bytebuddy:byte-buddy:1.14.9 (1 constraints: 8f123b21)
net.bytebuddy:byte-buddy:1.15.11 (2 constraints: 0d1e9b95)
org.checkerframework:checker-qual:3.43.0 (1 constraints: 4c0a4abf)
org.jetbrains:annotations:24.1.0 (1 constraints: 331166d1)
org.slf4j:slf4j-api:1.7.36 (1 constraints: 471091b6)

[Test dependencies]
org.assertj:assertj-core:3.27.3 (1 constraints: 4105513b)
org.junit:junit-bom:5.11.2 (7 constraints: c6758106)
org.junit.jupiter:junit-jupiter:5.11.2 (2 constraints: b91096ee)
org.junit.jupiter:junit-jupiter-api:5.11.2 (4 constraints: 333963e3)
Expand Down
1 change: 1 addition & 0 deletions versions.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
com.fasterxml.jackson.core:jackson-databind = 2.13.2.1
com.google.guava:guava = 33.3.1-jre
org.assertj:assertj-core = 3.27.3
org.junit.jupiter:* = 5.11.2
org.junit.platform:* = 1.11.2
org.slf4j:* = 1.7.36
Expand Down