* Use java 11 * Use .of - Replace Arrays.asList with List.of - Replace HashSet<>(List.of()) with Set.of * Formatting
This commit is contained in:
@ -25,14 +25,9 @@ package com.iluwatar.hexagonal.domain;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -43,8 +38,7 @@ class LotteryNumbersTest {
|
||||
|
||||
@Test
|
||||
void testGivenNumbers() {
|
||||
LotteryNumbers numbers = LotteryNumbers.create(
|
||||
Set.of(1, 2, 3, 4));
|
||||
LotteryNumbers numbers = LotteryNumbers.create(Set.of(1, 2, 3, 4));
|
||||
assertEquals(numbers.getNumbers().size(), 4);
|
||||
assertTrue(numbers.getNumbers().contains(1));
|
||||
assertTrue(numbers.getNumbers().contains(2));
|
||||
@ -54,8 +48,7 @@ class LotteryNumbersTest {
|
||||
|
||||
@Test
|
||||
void testNumbersCantBeModified() {
|
||||
LotteryNumbers numbers = LotteryNumbers.create(
|
||||
Set.of(1, 2, 3, 4));
|
||||
LotteryNumbers numbers = LotteryNumbers.create(Set.of(1, 2, 3, 4));
|
||||
assertThrows(UnsupportedOperationException.class, () -> numbers.getNumbers().add(5));
|
||||
}
|
||||
|
||||
@ -67,13 +60,10 @@ class LotteryNumbersTest {
|
||||
|
||||
@Test
|
||||
void testEquals() {
|
||||
LotteryNumbers numbers1 = LotteryNumbers.create(
|
||||
Set.of(1, 2, 3, 4));
|
||||
LotteryNumbers numbers2 = LotteryNumbers.create(
|
||||
Set.of(1, 2, 3, 4));
|
||||
LotteryNumbers numbers1 = LotteryNumbers.create(Set.of(1, 2, 3, 4));
|
||||
LotteryNumbers numbers2 = LotteryNumbers.create(Set.of(1, 2, 3, 4));
|
||||
assertEquals(numbers1, numbers2);
|
||||
LotteryNumbers numbers3 = LotteryNumbers.create(
|
||||
Set.of(11, 12, 13, 14));
|
||||
LotteryNumbers numbers3 = LotteryNumbers.create(Set.of(11, 12, 13, 14));
|
||||
assertNotEquals(numbers1, numbers3);
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -25,8 +25,6 @@ package com.iluwatar.hexagonal.domain;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
@ -23,15 +23,13 @@
|
||||
|
||||
package com.iluwatar.hexagonal.test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.iluwatar.hexagonal.domain.LotteryNumbers;
|
||||
import com.iluwatar.hexagonal.domain.LotteryTicket;
|
||||
import com.iluwatar.hexagonal.domain.LotteryTicketId;
|
||||
import com.iluwatar.hexagonal.domain.PlayerDetails;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* Utilities for lottery tests
|
||||
|
Reference in New Issue
Block a user