@@ -0,0 +1,2000 @@
+package com.storage.mywarehouse.Dao;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.jupiter.api.Assertions.assertAll;%0A%0Aimport com.storage.mywarehouse.Entity.Warehouse;%0Aimport java.util.List;%0A%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.api.AfterEach;%0A%0Apublic class WarehouseDaoTest %7B%0A%0A    private static final int ZERO = 0;%0A    private static final int ONE = 1;%0A    private static final int TWO = 2;%0A    private static final int THREE = 3;%0A    private static final String ANY = %22ANY%22;%0A    private static final String ANY2 = %22ANY2%22;%0A    private static final String ANY3 = %22ANY3%22;%0A    private static final double DOUBLE_VAL = 1.1;%0A    private Warehouse sut1;%0A    private Warehouse sut2;%0A    private Warehouse sut3;%0A    private Warehouse ret1;%0A    private List%3CWarehouse%3E rets;%0A%0A    @AfterEach%0A    public void restore()%7B%0A%09WarehouseDAO.deleteAll(WarehouseDAO.findAll());%0A    %7D%0A%0A    @Test%0A    public void testSaveNFindAllNDeleteAll() %7B%0A        sut1 = new Warehouse(ANY);%0A        sut2 = new Warehouse(ANY2);%0A        sut3 = new Warehouse(ANY3);%0A%0A%09WarehouseDAO.save(sut1);%0A%09WarehouseDAO.save(sut2);%0A%09WarehouseDAO.save(sut3);%0A%0A%09rets = WarehouseDAO.findAll();%0A%0A        assertAll(%22test if warehouses are saved%22,%0A            () -%3E assertEquals(THREE, rets.size()),%0A            () -%3E assertEquals(ONE, WarehouseDAO.findByName(ANY2).getWarehouseId()),%0A            () -%3E assertEquals(ZERO, WarehouseDAO.findByName(ANY).getWarehouseId()),%0A            () -%3E assertEquals(TWO, WarehouseDAO.findByName(ANY3).getWarehouseId()));%0A%0A%09WarehouseDAO.deleteAll(WarehouseDAO.findAll());%0A%09rets = WarehouseDAO.findAll();%0A%0A%09assertEquals(ZERO, rets.size());%0A    %7D%0A%0A    @Test%0A    public void testUpdate() %7B%0A        sut1 = new Warehouse(ONE, ANY);%0A%09WarehouseDAO.save(sut1);%0A%09ret1 = WarehouseDAO.findByName(ANY);%0A%0A%09assertEquals(ANY, ret1.getName());%0A%0A%09sut1.setName(ANY2);%0A%09WarehouseDAO.update(sut1);%0A%0A%09assertEquals(ret1.getWarehouseId(), WarehouseDAO.findByName(ANY2).getWarehouseId());%0A    %7D%0A%7D%0A%0A

test coverage for Warehouse DAO