Skip to content

Commit f6ad760

Browse files
Prosperro-atltboychuk
authored andcommitted
CrazyGenerics add test for checking public accessor type by new methods
1 parent d14505d commit f6ad760

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

1-0-java-basics/1-3-1-crazy-generics/src/test/java/com/bobocode/basics/CrazyGenericsTest.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,16 @@ static Stream<Arguments> hasDuplicatesArgs() {
722722
);
723723
}
724724

725+
@Test
726+
@Order(58)
727+
@DisplayName("Method findMax has public accessor type")
728+
void findMaxHasPublicAccessorType() {
729+
var findMaxMethod = getMethodByName(CollectionUtil.class, "findMax");
730+
assertThat(findMaxMethod).isNotNull();
731+
}
725732

726733
@ParameterizedTest
727-
@Order(58)
734+
@Order(59)
728735
@MethodSource("findMaxArgs")
729736
@DisplayName("Method findMax returns the max value based on given comparator")
730737
@SneakyThrows
@@ -755,7 +762,15 @@ static Stream<Arguments> findMaxArgs() {
755762
}
756763

757764
@Test
758-
@Order(59)
765+
@Order(60)
766+
@DisplayName("Method findMostRecentlyCreatedEntity has public accessor type")
767+
void findMostRecentlyCreatedEntityHasPublicAccessorType() {
768+
var findMaxMethod = getMethodByName(CollectionUtil.class, "findMostRecentlyCreatedEntity");
769+
assertThat(findMaxMethod).isNotNull();
770+
}
771+
772+
@Test
773+
@Order(61)
759774
@DisplayName("findMostRecentlyCreatedEntity is a generic method that accepts a collection of entities")
760775
void findMostRecentlyCreatedEntityIsAGenericMethod() {
761776
var hasDuplicatesMethod = getMethodByName(CollectionUtil.class, "findMostRecentlyCreatedEntity");
@@ -767,7 +782,7 @@ void findMostRecentlyCreatedEntityIsAGenericMethod() {
767782
}
768783

769784
@ParameterizedTest
770-
@Order(60)
785+
@Order(62)
771786
@MethodSource("findMostRecentlyCreatedEntityArgs")
772787
@DisplayName("findMostRecentlyCreatedEntity returns the most recently created entity")
773788
@SneakyThrows
@@ -794,7 +809,7 @@ static Stream<Arguments> findMostRecentlyCreatedEntityArgs() {
794809
}
795810

796811
@Test
797-
@Order(61)
812+
@Order(63)
798813
@DisplayName("findMostRecentlyCreatedEntity throws exception when collection is empty")
799814
@SneakyThrows
800815
void findMostRecentlyCreatedEntityThrowsException() {
@@ -805,7 +820,7 @@ void findMostRecentlyCreatedEntityThrowsException() {
805820
}
806821

807822
@Test
808-
@Order(62)
823+
@Order(64)
809824
@DisplayName("Method swap does not declare type parameter")
810825
void swapMethodDoesNotDeclareTypeParameter() {
811826
var swapMethod = getMethodByName(CollectionUtil.class, "swap");
@@ -815,7 +830,7 @@ void swapMethodDoesNotDeclareTypeParameter() {
815830
}
816831

817832
@Test
818-
@Order(63)
833+
@Order(65)
819834
@DisplayName("Method swap change elements by indexes")
820835
@SneakyThrows
821836
void swapChangesElements() {

0 commit comments

Comments
 (0)