Skip to content

Use Hamcrest assertions instead of JUnit in common/common - backport helidon-2.x (#1749) #4906

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
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
4 changes: 2 additions & 2 deletions common/common/src/test/java/io/helidon/common/ErrorsTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021 Oracle and/or its affiliates.
* Copyright (c) 2017, 2022 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,7 @@ class ErrorsTest {
private static final Logger LOGGER = Logger.getLogger(ErrorsTest.class.getName());

private static void assertErrorMessage(Optional<Errors.ErrorMessage> actual, String expected, String message) {
assertThat(actual, not(Optional.empty()));
assertThat(message, actual, not(Optional.empty()));
assertThat(actual.get().getMessage(), is(expected));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021 Oracle and/or its affiliates.
* Copyright (c) 2019, 2022 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,9 +18,9 @@

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.hamcrest.MatcherAssert.assertThat;

/**
* Unit tests for class {@link GenericTypeUtil}.
Expand All @@ -34,14 +34,14 @@ public class GenericTypeUtilTest{
public void testRawClass() {
Class<?> claszResult = GenericTypeUtil.rawClass(Object.class);

assertFalse(claszResult.isInterface());
assertFalse(claszResult.isArray());
assertEquals("class java.lang.Object", claszResult.toString());
assertEquals(1, claszResult.getModifiers());
assertFalse(claszResult.isEnum());
assertFalse(claszResult.isSynthetic());
assertFalse(claszResult.isAnnotation());
assertFalse(claszResult.isPrimitive());
assertThat(claszResult.isInterface(), is(false));
assertThat(claszResult.isArray(), is(false));
assertThat(claszResult.toString(), is("class java.lang.Object"));
assertThat(claszResult.getModifiers(), is(1));
assertThat(claszResult.isEnum(), is(false));
assertThat(claszResult.isSynthetic(), is(false));
assertThat(claszResult.isAnnotation(), is(false));
assertThat(claszResult.isPrimitive(), is(false));
}

@Test
Expand Down