/
javapractice
/
JavaPractice
Обзор
Документация
Войти
/
javapractice
/
JavaPractice
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
2
CI/CD
Аналитика
develop
ApachePOI/src/test/java/entities/AllocationTest.java
45 строк
2 KB
Zexa91x0
Apache POI - CompareTO for entities
22 май 2021, 11:07
22 май 2021, 11:07
af5ee33
Код
Авторство
О чём код?
package entities; import org.junit.Test; import org.junit.jupiter.api.Assertions; import java.util.List; import static org.junit.Assert.assertTrue; public class AllocationTest { public CellPhone cellPhone1 = new CellPhone(932_104_1000L, "Megafon"); public CellPhone cellPhone2 = new CellPhone(921_125_8220L, "MTS"); public CellPhone cellPhone3 = new CellPhone(932_104_1000L, "Megafon"); public Department department1 = new Department("dep1", "fun1", "OU1"); public Department department2 = new Department("dep2", "fun2", "OU2"); public Department department3 = new Department("dep3", "fun3", "OU3"); Owner owner1 = new Owner("comment1"); Owner owner2 = new Owner("comment2"); Owner owner3 = new Owner("tempID", "FirstNameTemp", "LastNameTemp", "comment3", new Department("d.", "f.", "o."), "mailTemp", 0); public Allocation allocation1 = new Allocation( List.of( new Owner("x123456", "Vasil", "Neuminz").setDepartment(department1)), cellPhone1); Allocation allocation2 = new Allocation(List.of(owner2), cellPhone2); Allocation allocation3 = new Allocation(List.of(owner3), cellPhone3); @Test public void compareTo() { Assertions.assertAll(() -> assertTrue(allocation1.compareTo(allocation2) > 0), () -> assertTrue(allocation1.compareTo(allocation3) == 0), () -> assertTrue(allocation2.compareTo(allocation3) < 0)); } }