diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 7a4bf35..4f08829 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -6,6 +6,7 @@
+
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 43c1af2..0d277dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,4 +22,20 @@
-
\ No newline at end of file
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.4.2
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.4.2
+ test
+
+
+
+
+
diff --git a/src/main/java/io/App.java b/src/main/java/io/App.java
new file mode 100644
index 0000000..b982620
--- /dev/null
+++ b/src/main/java/io/App.java
@@ -0,0 +1,24 @@
+package io;
+
+import services.SneakerService;
+
+public class App {
+ private SneakerService sneakerService = new SneakerService();
+
+ public static void main(String... args){
+ App application = new App();
+ application.init();
+ }
+
+ private void init() {
+ // application logic here
+ // call methods to take user input and interface with services
+
+
+ Console.printWelcome();
+ Console.mainMenu();
+ }
+
+
+
+}
diff --git a/src/main/java/io/Console.java b/src/main/java/io/Console.java
new file mode 100644
index 0000000..6c4da07
--- /dev/null
+++ b/src/main/java/io/Console.java
@@ -0,0 +1,220 @@
+package io;
+
+import models.Hat;
+import models.Sneaker;
+import services.HatService;
+import services.SneakerService;
+
+import java.sql.SQLOutput;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Scanner;
+
+public class Console {
+
+ public static class Inventory {
+ private SneakerService sneakerService = new SneakerService();
+ private HatService hatService = new HatService();
+
+ public SneakerService getSneakerService() {
+ return this.sneakerService;
+ }
+ public HatService getHatService() {
+ return this.hatService;
+ }
+
+ }
+ private static Inventory inventory = new Inventory();
+
+ public static void sampleInventory() {
+ SneakerService sneakerService = inventory.getSneakerService();
+ HatService hatService = inventory.getHatService();
+
+ sneakerService.create("Air Jordan 1", "Nike", "Basketball", 10.5, 200, 170.00F);
+ sneakerService.create("Nite Joggers", "Adidas", "Running", 10.5, 50, 120.00F);
+ sneakerService.create("Air Force 1", "Nike", "Casual", 10.5, 100, 90.00F);
+
+ hatService.create("Fitted", "Baseball", "New York Yankees", "Medium", 20, 39.99F);
+ hatService.create("Snap-back", "Basketball", "Los Angeles Lakers", "Large", 20, 44.99F);
+ hatService.create("Strap-back", "Football", "Philadelphia Eagles", "Medium", 20, 34.99F);
+ }
+
+ public static void print(String input) {
+ System.out.println(input);
+ }
+ public static void printWelcome() {
+ System.out.println("" +
+ "**************************************************\n" +
+ "*** Welcome and Bienvenue ***\n" +
+ "*** to ***\n" +
+ "*** ZipCo Inventory Manager ***\n" +
+ "**************************************************");
+ }
+
+ //==============================================================================================//
+ // =================================== ~*~ MAIN MENU ~*~ ====================================== //
+ // =============================================================================================//
+ public static void mainMenu() {
+ Scanner scanner = new Scanner(System.in);
+ Integer input;
+ print(" ~*~ MAIN MENU ~*~ \n" +
+ "Please enter a number from the menu options");
+ print("1 - Show existing products");
+ print("2 - Update products");
+ print("3 - Delete products");
+ print("Press any other numbers to Quit \n > ");
+ input = scanner.nextInt();
+
+ switch(input) {
+ case 1:
+ // Show Existing products options
+ productSelector();
+ break;
+
+ case 2:
+ // Show Update products options
+ updateSelector();
+ break;
+
+ case 3:
+ // Show Delete products options
+ deleteSelector();
+ break;
+
+ default:
+ print("Quiting Product Inventory Application ... Goodbye");
+ }
+ }
+
+
+
+ //=============================================================================================//
+ // ================================ SHOW EXISTING PRODUCTS OPTIONS =========================== //
+ //=============================================================================================//
+ private static void productSelector() {
+ Scanner scanner = new Scanner(System.in);
+ Integer input;
+ print("Enter the number corresponding to the product");
+ print("1 - Sneakers");
+ print("2 - Hats");
+ print("~*~ OR ~*~");
+ print("3 - Main Menu");
+
+ input = scanner.nextInt();
+
+ switch(input) {
+ case 1:
+ // Show sneakers inventory information
+ printSneakersList(inventory.getSneakerService().findAll());
+ productSelector();
+ break;
+ case 2:
+ // Show hats inventory information
+ printHatsList(inventory.getHatService().findAll());
+ productSelector();
+ break;
+ case 3:
+ // Go back to main menu
+ mainMenu();
+ break;
+ default:
+ print("Please enter a valid number ... Try again!");
+ productSelector();
+ }
+
+ }
+
+ //=================================================================================================//
+ // ================================ INFO GOES INTO PRODUCT SELECTOR ============================ //
+ //=================================================================================================//
+ public static void printSneakersList (Sneaker[] list) {
+ ArrayList sneakerList = new ArrayList<>(Arrays.asList(list));
+
+ for (Sneaker element : sneakerList) {
+ print(element.getName() + element.getBrand() + element.getSport() + element.getSize() + element.getQuantity() + element.getPrice());
+ }
+ }
+ public static void printHatsList (Hat[] list) {
+ ArrayList hatList = new ArrayList<>(Arrays.asList(list));
+
+ for (Hat element : hatList) {
+ print(element.getType() + element.getSport() + element.getTeam() + element.getSize() + element.getQuantity() + element.getPrice());
+ }
+ }
+
+ //=================================================================================================//
+ // ================================ SHOW UPDATE PRODUCTS OPTIONS ================================= //
+ //=================================================================================================//
+ private static void updateSelector() {
+ Scanner scanner = new Scanner(System.in);
+ Integer input;
+ print("Enter the number corresponding to the product");
+ print("1 - Sneakers");
+ print("2 - Hats");
+ print("~*~ OR ~*~");
+ print("3 - Main Menu");
+
+ input = scanner.nextInt();
+
+ switch (input) {
+ case 1:
+ // Allow user to update sneakers
+
+ updateSelector();
+ break;
+ case 2:
+ // Allow user to update hats
+
+ updateSelector();
+ break;
+ case 3:
+ // Go back to main menu
+ mainMenu();
+ break;
+ default:
+ print("Please enter a valid number ... Try again!");
+ updateSelector();
+ }
+ }
+
+
+
+
+ //=================================================================================================//
+ // ================================ SHOW DELETE PRODUCTS OPTIONS ================================= //
+ //=================================================================================================//
+
+ private static void deleteSelector() {
+ Scanner scanner = new Scanner(System.in);
+ Integer input;
+ print("Enter the number corresponding to the product");
+ print("1 - Sneakers");
+ print("2 - Hats");
+ print("~*~ OR ~*~");
+ print("3 - Main Menu");
+
+ input = scanner.nextInt();
+
+ switch (input) {
+ case 1:
+ // Allow user to delete sneaker
+
+ deleteSelector();
+ break;
+ case 2:
+ // Allow user to delete hat
+
+ deleteSelector();
+ break;
+ case 3:
+ // Go back to main menu
+ mainMenu();
+ break;
+ default:
+ print("Please enter a valid number ... Try again!");
+ deleteSelector();
+ }
+ }
+
+
+}
diff --git a/src/main/java/models/Hat.java b/src/main/java/models/Hat.java
new file mode 100644
index 0000000..8492538
--- /dev/null
+++ b/src/main/java/models/Hat.java
@@ -0,0 +1,91 @@
+package models;
+
+public class Hat {
+ private int hatId;
+ private String type; //fitted, snapback or strapback
+ private String sport; //baseball, basketball, NFL
+ private String team;
+ private String size; //small/ medium, large
+ private int quantity;
+ private float price;
+
+ public Hat(){
+ this.hatId = Integer.MAX_VALUE;
+ this.type = "";
+ this.sport = "";
+ this.team = "";
+ this.size = "";
+ this.quantity = Integer.MAX_VALUE;
+ this.price = Float.MAX_VALUE;
+ }
+
+ public Hat (int hatId, String type, String sport, String team, String size, int quantity, float price) {
+ this.hatId = hatId;
+ this.type = type;
+ this.sport = sport;
+ this.team = team;
+ this.size = size;
+ this.quantity = quantity;
+ this.price = price;
+ }
+
+ //================ SETTERS ================//
+ public void setHatId(int hatId) {
+ this.hatId = hatId;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void setSport(String sport) {
+ this.sport = sport;
+ }
+
+ public void setTeam(String team) {
+ this.team = team;
+ }
+
+ public void setSize(String size) {
+ this.size = size;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public void setPrice(float price) {
+ this.price = price;
+ }
+
+ //================ GETTERS ================//
+ public int getHatId() {
+ return hatId;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getSport() {
+ return sport;
+ }
+
+ public String getTeam() {
+ return team;
+ }
+
+ public String getSize() {
+ return size;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public float getPrice() {
+ return price;
+ }
+
+
+}
diff --git a/src/main/java/models/Sneaker.java b/src/main/java/models/Sneaker.java
new file mode 100644
index 0000000..1be5de4
--- /dev/null
+++ b/src/main/java/models/Sneaker.java
@@ -0,0 +1,99 @@
+package models;
+
+public class Sneaker {
+ private int sneakerId;
+ private String name;
+ private String brand;
+ private String sport;
+ private double size;
+ private int quantity;
+ private float price;
+
+ public Sneaker() {
+// this.sneakerId = Integer.MAX_VALUE;
+// this.name = "";
+// this.brand = "";
+// this.sport = "";
+// this.size = Double.MAX_VALUE;
+// this.quantity = Integer.MAX_VALUE;
+// this.price = Float.MAX_VALUE;
+ }
+
+ public Sneaker(int sneakerId, String name, String brand, String sport, double size, int quantity, float price) {
+ this.sneakerId = sneakerId;
+ this.name = name;
+ this.brand = brand;
+ this.sport = sport;
+ this.size = size;
+ this.quantity = quantity;
+ this.price = price;
+}
+
+
+ public static void main(String[] args) {
+
+ }
+
+
+ //================ SETTERS ================//
+ public void setSneakerId(int sneakerId) {
+ this.sneakerId = sneakerId;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setBrand(String brand) {
+ this.brand = brand;
+ }
+
+ public void setSport(String sport) {
+ this.sport = sport;
+ }
+
+ public void setSize(double size) {
+ this.size = size;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public void setPrice(float price) {
+ this.price = price;
+ }
+
+
+ //================ GETTERS ================//
+ public int getSneakerId() {
+ return sneakerId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getBrand() {
+ return brand;
+ }
+
+ public String getSport() {
+ return sport;
+ }
+
+ public double getSize() {
+ return size;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public float getPrice() {
+ return price;
+ }
+
+}
+
+
diff --git a/src/main/java/services/HatService.java b/src/main/java/services/HatService.java
new file mode 100644
index 0000000..76e7cb6
--- /dev/null
+++ b/src/main/java/services/HatService.java
@@ -0,0 +1,45 @@
+package services;
+
+import models.Hat;
+
+import java.util.ArrayList;
+
+public class HatService {
+ private static int nextId = 1;
+
+ private static ArrayList inventory = new ArrayList<>();
+
+ public static Hat create (String type, String sport, String team, String size, int quantity, float price) {
+ Hat createdHat = new Hat (nextId++, type, sport, team, size, quantity, price);
+ inventory.add(createdHat);
+ return createdHat;
+ }
+
+ // read
+ public Hat findHat(int hatId) {
+ for (Hat element : inventory) {
+ if(element.getHatId() == hatId) {
+ return element;
+ }
+ }
+ return null;
+ }
+
+ // read all
+ public Hat[] findAll() {
+
+ return inventory.toArray(new Hat[0]);
+ }
+
+ // delete
+ public boolean delete(int hatId) {
+ for (Hat element : inventory) {
+ if (element.getHatId() == hatId) {
+ inventory.remove(element);
+ return true;
+ }
+ }
+ return false;
+ }
+// add method for updating
+}
diff --git a/src/main/java/services/SneakerService.java b/src/main/java/services/SneakerService.java
new file mode 100644
index 0000000..5cf6885
--- /dev/null
+++ b/src/main/java/services/SneakerService.java
@@ -0,0 +1,44 @@
+package services;
+
+import models.Sneaker;
+import java.util.ArrayList;
+
+public class SneakerService {
+ private static int nextId = 1;
+
+ private static ArrayList inventory = new ArrayList<>();
+
+ public static Sneaker create(String name, String brand, String sport, double size, int quantity, float price) {
+ Sneaker createdSneaker = new Sneaker(nextId++, name, brand, sport, size, quantity, price);
+ inventory.add(createdSneaker);
+ return createdSneaker;
+ }
+
+ // read
+ public Sneaker findSneaker(int sneakerId) {
+ for (Sneaker element : inventory) {
+ if (element.getSneakerId() == sneakerId) {
+ return element;
+ }
+ }
+ return null;
+ }
+
+ // read all
+ public Sneaker[] findAll() {
+
+ return inventory.toArray(new Sneaker[0]);
+ }
+
+ // delete
+ public boolean delete(int sneakerId) {
+ for (Sneaker element : inventory) {
+ if (element.getSneakerId() == sneakerId) {
+ inventory.remove(element);
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/src/test/java/models/HatTest.java b/src/test/java/models/HatTest.java
new file mode 100644
index 0000000..282b117
--- /dev/null
+++ b/src/test/java/models/HatTest.java
@@ -0,0 +1,126 @@
+package models;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class HatTest {
+
+ @Test
+ public void setHatIdTest() {
+ //Given
+ int expected = 503;
+
+ // When
+ Hat testHat = new Hat();
+ testHat.setHatId(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testHat.getHatId());
+ }
+
+ @Test
+ public void setTypeTest() {
+ //Given
+ String expected = "Fitted";
+
+ // When
+ Hat testHat = new Hat();
+ testHat.setType(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testHat.getType());
+ }
+
+ @Test
+ public void setSportTest() {
+ //Given
+ String expected = "Baseball";
+
+ // When
+ Hat testHat = new Hat();
+ testHat.setSport(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testHat.getSport());
+ }
+
+ @Test
+ public void setTeamTest() {
+ //Given
+ String expected = "Chicago White Sox";
+
+ // When
+ Hat testHat = new Hat();
+ testHat.setTeam(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testHat.getTeam());
+ }
+
+ @Test
+ public void setSizeTest() {
+ //Given
+ String expected = "Small";
+
+ // When
+ Hat testHat = new Hat();
+ testHat.setSize(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testHat.getSize());
+ }
+
+ @Test
+ public void setQuantityTest() {
+ //Given
+ int expected = 20;
+
+ // When
+ Hat testHat = new Hat();
+ testHat.setQuantity(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testHat.getQuantity());
+ }
+
+ @Test
+ public void setPriceTest() {
+ //Given
+ float expected = 39.99F;
+
+ // When
+ Hat testHat = new Hat();
+ testHat.setPrice(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testHat.getPrice());
+ }
+
+ @Test
+ public void constructorTest() {
+ // Given
+ int expectedId = 302;
+ String expectedType = "Fitted";
+ String expectedSport = "Baseball";
+ String expectedTeam = "New York Yankees";
+ String expectedSize = "Small";
+ int expectedQuantity = 20;
+ float expectedPrice = 40.00F;
+
+ // When
+ Hat testHat = new Hat(expectedId, expectedType, expectedSport,
+ expectedTeam, expectedSize, expectedQuantity, expectedPrice);
+
+ // Then
+ Assertions.assertEquals(expectedId, testHat.getHatId());
+ Assertions.assertEquals(expectedType, testHat.getType());
+ Assertions.assertEquals(expectedSport, testHat.getSport());
+ Assertions.assertEquals(expectedTeam, testHat.getTeam());
+ Assertions.assertEquals(expectedSize, testHat.getSize());
+ Assertions.assertEquals(expectedQuantity, testHat.getQuantity());
+ Assertions.assertEquals(expectedPrice, testHat.getPrice());
+
+ }
+
+
+}
diff --git a/src/test/java/models/SneakerTest.java b/src/test/java/models/SneakerTest.java
new file mode 100644
index 0000000..8454734
--- /dev/null
+++ b/src/test/java/models/SneakerTest.java
@@ -0,0 +1,127 @@
+package models;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class SneakerTest {
+
+ @Test
+ public void setSneakerIdTest() {
+ //Given
+ int expected = 7001;
+
+ // When
+ Sneaker testSneaker = new Sneaker();
+ testSneaker.setSneakerId(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testSneaker.getSneakerId());
+ }
+
+ @Test
+ public void setNameTest() {
+ // Given
+ String expected = "YeezyBoost 700";
+
+ // When
+ Sneaker testSneaker = new Sneaker();
+ testSneaker.setName(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testSneaker.getName());
+ }
+
+ @Test
+ public void setBrandTest() {
+ //Given
+ String expected = "Adidas";
+
+ // When
+ Sneaker testSneaker = new Sneaker();
+ testSneaker.setBrand(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testSneaker.getBrand());
+ }
+
+ @Test
+ public void setSportTest() {
+ //Given
+ String expected = "Running";
+
+ // When
+ Sneaker testSneaker = new Sneaker();
+ testSneaker.setSport(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testSneaker.getSport());
+ }
+
+ @Test
+ public void setSizeTest() {
+ //Given
+ double expected = 10.5;
+
+ // When
+ Sneaker testSneaker = new Sneaker();
+ testSneaker.setSize(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testSneaker.getSize());
+ }
+
+ @Test
+ public void setQuantityTest() {
+ //Given
+ int expected = 20;
+
+ // When
+ Sneaker testSneaker = new Sneaker();
+ testSneaker.setQuantity(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testSneaker.getQuantity());
+ }
+
+ @Test
+ public void setPriceTest() {
+ //Given
+ float expected = 200.00F;
+
+ // When
+ Sneaker testSneaker = new Sneaker();
+ testSneaker.setPrice(expected);
+
+ // Then
+ Assertions.assertEquals(expected, testSneaker.getPrice());
+ }
+
+ @Test
+ public void constructorTest() {
+ // Given
+ int expectedId = 6;
+ String expectedName = "Stan Smith";
+ String expectedBrand = "Adidas";
+ String expectedSport = "Tennis";
+ double expectedSize = 10.5;
+ int expectedQuantity = 20;
+ float expectedPrice = 80.00F;
+
+ // When
+ Sneaker testSneaker = new Sneaker(expectedId, expectedName, expectedBrand,
+ expectedSport, expectedSize, expectedQuantity, expectedPrice);
+
+ // Then
+ Assertions.assertEquals(expectedId, testSneaker.getSneakerId());
+ Assertions.assertEquals(expectedName, testSneaker.getName());
+ Assertions.assertEquals(expectedBrand, testSneaker.getBrand());
+ Assertions.assertEquals(expectedSport, testSneaker.getSport());
+ Assertions.assertEquals(expectedSize, testSneaker.getSize());
+ Assertions.assertEquals(expectedQuantity, testSneaker.getQuantity());
+ Assertions.assertEquals(expectedPrice, testSneaker.getPrice());
+
+ }
+
+
+
+}
diff --git a/src/test/java/services/HatServiceTest.java b/src/test/java/services/HatServiceTest.java
new file mode 100644
index 0000000..8baee76
--- /dev/null
+++ b/src/test/java/services/HatServiceTest.java
@@ -0,0 +1,61 @@
+package services;
+
+
+import models.Hat;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class HatServiceTest {
+ @Test
+ public void createTest() {
+ // Given
+ String expectedType = "Fitted";
+ String expectedSport = "Baseball";
+ String expectedTeam = "New York Yankees";
+ String expectedSize = "Small";
+ int expectedQuantity = 20;
+ float expectedPrice = 40.00F;
+
+ // When
+ HatService hatService = new HatService();
+ Hat testHat = HatService.create(expectedType, expectedSport, expectedTeam,
+ expectedSize, expectedQuantity, expectedPrice);
+
+ int actualId = testHat.getHatId();
+ String actualType = testHat.getType();
+ String actualSport = testHat.getSport();
+ String actualTeam = testHat.getTeam();
+ String actualSize = testHat.getSize();
+ int actualQuantity = testHat.getQuantity();
+ float actualPrice = testHat.getPrice();
+
+ // Then
+ Assertions.assertEquals(Integer.class.getName(), new Integer(actualId).getClass().getName());
+ Assertions.assertEquals(expectedType, actualType);
+ Assertions.assertEquals(expectedSport, actualSport);
+ Assertions.assertEquals(expectedTeam, actualTeam);
+ Assertions.assertEquals(expectedSize, actualSize);
+ Assertions.assertEquals(expectedQuantity, actualQuantity);
+ Assertions.assertEquals(expectedPrice, actualPrice);
+ }
+
+ @Test
+ public void findHatTest() {
+ // Given
+ String expectedType = "Fitted";
+ String expectedSport = "Baseball";
+ String expectedTeam = "New York Yankees";
+ String expectedSize = "Small";
+ int expectedQuantity = 20;
+ float expectedPrice = 40.00F;
+
+ // When
+ HatService hatService = new HatService();
+ Hat testHat = HatService.create(expectedType, expectedSport, expectedTeam,
+ expectedSize, expectedQuantity, expectedPrice);
+
+ Hat actual = hatService.findHat(testHat.getHatId());
+
+ Assertions.assertEquals(testHat, actual);
+ }
+}
diff --git a/src/test/java/services/SneakerServiceTest.java b/src/test/java/services/SneakerServiceTest.java
new file mode 100644
index 0000000..3ed9353
--- /dev/null
+++ b/src/test/java/services/SneakerServiceTest.java
@@ -0,0 +1,62 @@
+package services;
+
+import models.Sneaker;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class SneakerServiceTest {
+
+ @Test
+ public void createTest() {
+ // Given
+ String expectedName = "Stan Smith";
+ String expectedBrand = "Adidas";
+ String expectedSport = "Tennis";
+ double expectedSize = 10.5;
+ int expectedQuantity = 20;
+ float expectedPrice = 80.00F;
+
+ // When
+ SneakerService sneakerService = new SneakerService();
+ Sneaker testSneaker = SneakerService.create(expectedName, expectedBrand,
+ expectedSport, expectedSize, expectedQuantity, expectedPrice);
+
+ int actualId = testSneaker.getSneakerId();
+ String actualName = testSneaker.getName();
+ String actualBrand = testSneaker.getBrand();
+ String actualSport = testSneaker.getSport();
+ double actualSize = testSneaker.getSize();
+ int actualQuantity = testSneaker.getQuantity();
+ float actualPrice = testSneaker.getPrice();
+
+ // Then
+ Assertions.assertEquals(Integer.class.getName(), new Integer(actualId).getClass().getName());
+ Assertions.assertEquals(expectedName, actualName);
+ Assertions.assertEquals(expectedBrand, actualBrand);
+ Assertions.assertEquals(expectedSport, actualSport);
+ Assertions.assertEquals(expectedSize, actualSize);
+ Assertions.assertEquals(expectedQuantity, actualQuantity);
+ Assertions.assertEquals(expectedPrice, actualPrice);
+ }
+
+ @Test
+ public void findSneakerTest() {
+ // Given
+ String expectedName = "Stan Smith";
+ String expectedBrand = "Adidas";
+ String expectedSport = "Tennis";
+ double expectedSize = 10.5;
+ int expectedQuantity = 20;
+ float expectedPrice = 80.00F;
+
+ // When
+ SneakerService sneakerService = new SneakerService();
+ Sneaker testSneaker = SneakerService.create(expectedName, expectedBrand,
+ expectedSport, expectedSize, expectedQuantity, expectedPrice);
+
+ Sneaker actual = sneakerService.findSneaker(testSneaker.getSneakerId());
+
+ Assertions.assertEquals(testSneaker, actual);
+
+ }
+}