Skip to content

Commit d23abf4

Browse files
authored
Use Hamcrest assertions instead of JUnit in common/common (#1749) (#4886)
1 parent b2cdcef commit d23abf4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

common/common/src/test/java/io/helidon/common/ErrorsTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2021 Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2022 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ class ErrorsTest {
3434
private static final Logger LOGGER = Logger.getLogger(ErrorsTest.class.getName());
3535

3636
private static void assertErrorMessage(Optional<Errors.ErrorMessage> actual, String expected, String message) {
37-
assertThat(actual, not(Optional.empty()));
37+
assertThat(message, actual, not(Optional.empty()));
3838
assertThat(actual.get().getMessage(), is(expected));
3939
}
4040

common/common/src/test/java/io/helidon/common/GenericTypeUtilTest.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2021 Oracle and/or its affiliates.
2+
* Copyright (c) 2019, 2022 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,9 +18,9 @@
1818

1919
import org.junit.jupiter.api.Test;
2020

21-
import static org.junit.jupiter.api.Assertions.assertEquals;
22-
import static org.junit.jupiter.api.Assertions.assertFalse;
21+
import static org.hamcrest.CoreMatchers.is;
2322
import static org.junit.jupiter.api.Assertions.assertThrows;
23+
import static org.hamcrest.MatcherAssert.assertThat;
2424

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

37-
assertFalse(claszResult.isInterface());
38-
assertFalse(claszResult.isArray());
39-
assertEquals("class java.lang.Object", claszResult.toString());
40-
assertEquals(1, claszResult.getModifiers());
41-
assertFalse(claszResult.isEnum());
42-
assertFalse(claszResult.isSynthetic());
43-
assertFalse(claszResult.isAnnotation());
44-
assertFalse(claszResult.isPrimitive());
37+
assertThat(claszResult.isInterface(), is(false));
38+
assertThat(claszResult.isArray(), is(false));
39+
assertThat(claszResult.toString(), is("class java.lang.Object"));
40+
assertThat(claszResult.getModifiers(), is(1));
41+
assertThat(claszResult.isEnum(), is(false));
42+
assertThat(claszResult.isSynthetic(), is(false));
43+
assertThat(claszResult.isAnnotation(), is(false));
44+
assertThat(claszResult.isPrimitive(), is(false));
4545
}
4646

4747
@Test

0 commit comments

Comments
 (0)