tdd : inventory test
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
package com.example.inventorytdd;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class Inventory {
|
||||||
|
|
||||||
|
private int length;
|
||||||
|
private int width;
|
||||||
|
private int height;
|
||||||
|
private InventoryTypeEnum type;
|
||||||
|
private int capacity;
|
||||||
|
private int current;
|
||||||
|
|
||||||
|
public int getUsableCapa() {
|
||||||
|
return this.capacity - this.current;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.example.inventorytdd;
|
||||||
|
|
||||||
|
public enum InventoryTypeEnum {
|
||||||
|
|
||||||
|
NORMAL, COLD, FROZEN
|
||||||
|
}
|
||||||
@@ -1,4 +1,54 @@
|
|||||||
package com.example.inventorytdd;
|
package com.example.inventorytdd;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
public class InventoryTests {
|
public class InventoryTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void inventory_size_test() {
|
||||||
|
Inventory inventory = new Inventory();
|
||||||
|
|
||||||
|
inventory.setLength(10);
|
||||||
|
inventory.setWidth(10);
|
||||||
|
inventory.setHeight(10);
|
||||||
|
|
||||||
|
assertEquals(10, inventory.getLength());
|
||||||
|
assertEquals(10, inventory.getWidth());
|
||||||
|
assertEquals(10, inventory.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void inventory_type_test() {
|
||||||
|
Inventory inventory = new Inventory();
|
||||||
|
inventory.setType(InventoryTypeEnum.COLD);
|
||||||
|
|
||||||
|
assertEquals(InventoryTypeEnum.COLD, inventory.getType());
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
void inventory_capacity_test() {
|
||||||
|
Inventory inventory = new Inventory();
|
||||||
|
inventory.setCapacity(10);
|
||||||
|
|
||||||
|
assertEquals(10, inventory.getCapacity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void inventory_current_test() {
|
||||||
|
Inventory inventory = new Inventory();
|
||||||
|
inventory.setCurrent(5);
|
||||||
|
|
||||||
|
assertEquals(5, inventory.getCurrent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void inventory_usableCapa_test() {
|
||||||
|
Inventory inventory = new Inventory();
|
||||||
|
inventory.setCapacity(10);
|
||||||
|
inventory.setCurrent(5);
|
||||||
|
|
||||||
|
assertEquals(5, inventory.getUsableCapa());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
- TO-DO
|
- TO-DO
|
||||||
Inventory 의 크기를 알 수 있어야 한다.
|
[v] Inventory 의 크기를 알 수 있어야 한다.
|
||||||
Inventory 의 타입을 알 수 있어야 한다.
|
[v] Inventory 의 타입을 알 수 있어야 한다.
|
||||||
총 저장 수량을 알 수 있어야 한다.
|
[v] 총 저장 수량을 알 수 있어야 한다.
|
||||||
현재 저장된 수량을 알 수 있어야 한다.
|
[v] 현재 저장된 수량을 알 수 있어야 한다.
|
||||||
|
[v] Inventory 의 타입을 Enum 값으로 만든다.
|
||||||
|
[v] 앞으로 저장 가능한 수량을 알 수 있어야 한다.
|
||||||
|
[] InventoryHelper 클래스 생성
|
||||||
|
[] Capacity 이상으로 입고 되는 것을 방지한다.
|
||||||
|
|||||||
Reference in New Issue
Block a user