Merge branch '#39-Amazon-Product-API'
This commit is contained in:
33
src/test/java/de/rwu/easydrop/api/dto/ProductDTOTest.java
Normal file
33
src/test/java/de/rwu/easydrop/api/dto/ProductDTOTest.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package de.rwu.easydrop.api.dto;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ProductDTOTest {
|
||||
@Test
|
||||
void testToString1() {
|
||||
ProductDTO product1 = new ProductDTO("12345", "Amazon");
|
||||
product1.setMerchant("Merchant A");
|
||||
product1.setCurrentPrice(19.99);
|
||||
product1.setAvailable(true);
|
||||
|
||||
String expectedString1 = "ProductDTO{12345 from Merchant A (Amazon) at 19,99 € (available: yes)}";
|
||||
String result1 = product1.toString();
|
||||
|
||||
assertEquals(expectedString1, result1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testToString2() {
|
||||
ProductDTO product2 = new ProductDTO("67890", "eBay");
|
||||
product2.setMerchant("Merchant B");
|
||||
product2.setCurrentPrice(9.99);
|
||||
product2.setAvailable(false);
|
||||
|
||||
String expectedString2 = "ProductDTO{67890 from Merchant B (eBay) at 9,99 € (available: no)}";
|
||||
String result2 = product2.toString();
|
||||
|
||||
assertEquals(expectedString2, result2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user