/
javapractice
/
JavaPractice
Обзор
Документация
Войти
/
javapractice
/
JavaPractice
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
2
CI/CD
Аналитика
develop
ApachePOI/src/test/java/utils/AllocationsDBTest.java
74 строки
3 KB
Zexa91x0
Apache POI - PriceGetterMegafon
24 май 2021, 21:09
24 май 2021, 21:09
8756120
Код
Авторство
О чём код?
package utils; import entities.Allocation; import entities.CellPhone; import entities.Department; import entities.Owner; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.junit.Test; import java.io.File; import java.io.IOException; import java.util.stream.Stream; public class AllocationsDBTest { String filePath = "D:\\Skills\\_Repository\\JavaPractice\\ApachePOI\\src\\main\\resources\\test.xlsx"; AllocationsDB allocationsDB = this.allocationsDB = new AllocationsDB(new XLSXLoader(new File(filePath)).getWorkbook().getSheetAt(0), 241); Owner owner1 = new Owner("Drobotenko, Andrey"); Owner owner2 = new Owner("белявский Алексей"); Owner owner4 = new Owner("Nikitin, Petr"); Owner owner3 = new Owner("tempID", "FirstNameTemp", "LastNameTemp", "Drobotenko, Andrey", new Department("d.", "f.", "o."), "mailTemp", 0); public AllocationsDBTest() throws IOException, InvalidFormatException { } @Test public void getNumbersListForOwner() { // получить List<CellPhone> для Owner allocationsDB.getNumbersListForOwner(new Owner("Drobotenko, Andrey")).forEach(System.out::println); } @Test public void getOwnersListForNumber() { // получить List<Owner> для CellPhone allocationsDB.getOwnersListForNumber(new CellPhone(9048724453L, "Megafon")).forEach(System.out::println); } @Test public void printAllocations() { // напечатать и получить все записи allocationsDB.printAllocations(); } @Test public void main() { Stream<Allocation> allocationStream = allocationsDB.getAllocationStream(); allocationStream.forEach(System.out::println); } @Test public void getAllocationsForOperator() { // получить только "MTS" allocationsDB.getAllocationsForOperator("MTS") .forEach(System.out::println); } @Test public void getNumbersListForDepartment() { Department department1 = new Department("Pressure Pumping PL215", "DIR_MNIN", "RMM"); Department department2 = new Department("Pressure Pumping PL215", "Pressure Pumping PL215", "Трубный участок"); Department department3 = new Department("Pressure Pumping PL215", "DIR_MNIN", "RMM"); Department department4 = new Department("Pressure Pumping PL215", "Pressure Pumping PL215", "Лаборатория"); // получить List<CellPhone> для Department allocationsDB.getNumbersListForDepartment(department1).forEach(System.out::println); } }