diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_36b748883e_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_36b748883e_Test.java new file mode 100644 index 00000000..e3453a10 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_36b748883e_Test.java @@ -0,0 +1,66 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.controller; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.*; + +public class ProductController_createProduct_36b748883e_Test { + + @InjectMocks + ProductController productController; + + @Mock + ProductRepository productRepository; + + @BeforeEach + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testCreateProduct_Success() { + Product product = new Product(); + product.setId(1L); // changed from int to Long + product.setName("Test Product"); + product.setDescription("Test Description"); + product.setPrice(100.0); + + when(productRepository.save(any(Product.class))).thenReturn(product); + + Product createdProduct = productController.createProduct(product); + + assertEquals(product.getId(), createdProduct.getId()); + assertEquals(product.getName(), createdProduct.getName()); + assertEquals(product.getDescription(), createdProduct.getDescription()); + assertEquals(product.getPrice(), createdProduct.getPrice()); + + verify(productRepository, times(1)).save(product); + } + + @Test + public void testCreateProduct_Failure() { + Product product = new Product(); + product.setId(1L); // changed from int to Long + product.setName("Test Product"); + product.setDescription("Test Description"); + product.setPrice(100.0); + + when(productRepository.save(any(Product.class))).thenReturn(null); + + Product createdProduct = productController.createProduct(product); + + assertEquals(null, createdProduct); + + verify(productRepository, times(1)).save(product); + } +} diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_dcaff736d4_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_dcaff736d4_Test.java new file mode 100644 index 00000000..ecd52c95 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_dcaff736d4_Test.java @@ -0,0 +1,56 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.controller; + +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.when; +import static org.mockito.ArgumentMatchers.any; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Optional; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.http.ResponseEntity; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; + +public class ProductController_deleteProduct_dcaff736d4_Test { + + @InjectMocks + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + @BeforeEach + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testDeleteProduct_Success() { + Product product = new Product(); + product.setId(1L); + + when(productRepository.findById(any(Long.class))).thenReturn(Optional.of(product)); + doNothing().when(productRepository).delete(product); + + ResponseEntity responseEntity = productController.deleteProduct(1L); + + assertEquals(200, responseEntity.getStatusCodeValue()); + } + + @Test + public void testDeleteProduct_NotFound() { + when(productRepository.findById(any(Long.class))).thenReturn(Optional.empty()); + + ResponseEntity responseEntity = productController.deleteProduct(1L); + + assertEquals(404, responseEntity.getStatusCodeValue()); + } +} diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_7e38cc05f6_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_7e38cc05f6_Test.java new file mode 100644 index 00000000..12b1d0f4 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_7e38cc05f6_Test.java @@ -0,0 +1,54 @@ +package com.bootexample4.products.controller; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.List; + +public class ProductController_getAllProducts_7e38cc05f6_Test { + + @InjectMocks + ProductController productController; + + @Mock + ProductRepository productRepository; + + @BeforeEach + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGetAllProducts() { + Product product1 = new Product(); + product1.setId(1L); + product1.setName("Product1"); + + Product product2 = new Product(); + product2.setId(2L); + product2.setName("Product2"); + + List products = Arrays.asList(product1, product2); + + when(productRepository.findAll()).thenReturn(products); + + List result = productController.getAllProducts(); + assertEquals(2, result.size()); + } + + @Test + public void testGetAllProducts_empty() { + when(productRepository.findAll()).thenReturn(Arrays.asList()); + + List result = productController.getAllProducts(); + assertEquals(0, result.size()); + } +} diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_d22f3ea272_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_d22f3ea272_Test.java new file mode 100644 index 00000000..5717751c --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_d22f3ea272_Test.java @@ -0,0 +1,57 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.controller; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import static org.mockito.Mockito.when; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.springframework.http.ResponseEntity; +import org.springframework.http.HttpStatus; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; + +import java.util.Optional; + +@ExtendWith(MockitoExtension.class) +public class ProductController_getProductById_d22f3ea272_Test { + + @InjectMocks + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + @Test + public void testGetProductById_Found() { + Long id = 1L; // TODO: Change the value to the ID of a product that exists in your database. + Product product = new Product(); + product.setId(id); + // TODO: Add more properties to the product as needed. + + when(productRepository.findById(id)).thenReturn(Optional.of(product)); + + ResponseEntity response = productController.getProductById(id); + + assertEquals(HttpStatus.OK, response.getStatusCode()); + assertEquals(product, response.getBody()); + } + + @Test + public void testGetProductById_NotFound() { + Long id = 2L; // TODO: Change the value to the ID of a product that does not exist in your database. + + when(productRepository.findById(id)).thenReturn(Optional.empty()); + + ResponseEntity response = productController.getProductById(id); + + assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode()); + assertTrue(response.getBody() == null); + } +} diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_9454a9af90_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_9454a9af90_Test.java new file mode 100644 index 00000000..b859978f --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_9454a9af90_Test.java @@ -0,0 +1,67 @@ +package com.bootexample4.products.controller; + +import java.util.Optional; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyLong; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; +import org.springframework.http.ResponseEntity; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +@SpringBootTest +public class ProductController_updateProduct_9454a9af90_Test { + + @Autowired + private ProductController productController; + + @MockBean + private ProductRepository productRepository; + + private Product existingProduct; + + @BeforeEach + public void setup() { + existingProduct = new Product(); + existingProduct.setId(1L); + existingProduct.setName("Test Product"); + existingProduct.setDescription("Test Description"); + existingProduct.setPrice(100.00); + } + + @Test + public void testUpdateProduct_Success() { + Product newProduct = new Product(); + newProduct.setName("Updated Product"); + newProduct.setDescription("Updated Description"); + newProduct.setPrice(200.00); + + when(productRepository.findById(anyLong())).thenReturn(Optional.of(existingProduct)); + when(productRepository.save(any(Product.class))).thenReturn(newProduct); + + ResponseEntity response = productController.updateProduct(1L, newProduct); + + assertEquals(200, response.getStatusCodeValue()); + assertEquals(newProduct, response.getBody()); + } + + @Test + public void testUpdateProduct_NotFound() { + Product newProduct = new Product(); + newProduct.setName("Updated Product"); + newProduct.setDescription("Updated Description"); + newProduct.setPrice(200.00); + + when(productRepository.findById(anyLong())).thenReturn(Optional.empty()); + + ResponseEntity response = productController.updateProduct(1L, newProduct); + + assertEquals(404, response.getStatusCodeValue()); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_getDescription_b1844ea396_Test.java b/src/test/java/com/bootexample4/products/model/Product_getDescription_b1844ea396_Test.java new file mode 100644 index 00000000..4a80cf81 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getDescription_b1844ea396_Test.java @@ -0,0 +1,35 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.model; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.MockitoAnnotations; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_getDescription_b1844ea396_Test { + + @InjectMocks + private Product product; + + @BeforeEach + public void setup() { + MockitoAnnotations.openMocks(this); + } + + @Test + public void testGetDescription_Success() { + String expectedDescription = "Test Product Description"; + product.setDescription(expectedDescription); + String actualDescription = product.getDescription(); + assertEquals(expectedDescription, actualDescription, "Expected and actual descriptions should match"); + } + + @Test + public void testGetDescription_Null() { + product.setDescription(null); + String actualDescription = product.getDescription(); + assertEquals(null, actualDescription, "Description should be null"); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_getId_ba349b1eff_Test.java b/src/test/java/com/bootexample4/products/model/Product_getId_ba349b1eff_Test.java new file mode 100644 index 00000000..79429d4f --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getId_ba349b1eff_Test.java @@ -0,0 +1,32 @@ +package com.bootexample4.products.model; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +public class Product_getId_ba349b1eff_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testGetIdSuccess() { + Long expectedId = 1L; + product.setId(expectedId); + Long actualId = product.getId(); + assertEquals(expectedId, actualId, "The expected ID does not match the actual ID"); + } + + @Test + public void testGetIdFailure() { + Long unexpectedId = 2L; + product.setId(1L); + Long actualId = product.getId(); + assertNotEquals(unexpectedId, actualId, "The unexpected ID should not match the actual ID"); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_getName_8400ac6fb7_Test.java b/src/test/java/com/bootexample4/products/model/Product_getName_8400ac6fb7_Test.java new file mode 100644 index 00000000..1633d187 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getName_8400ac6fb7_Test.java @@ -0,0 +1,35 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.model; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_getName_8400ac6fb7_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testGetName_WhenNameIsSet() { + // TODO: replace "TestProduct" with the actual product name you want to test + String expectedProductName = "TestProduct"; + product.setName(expectedProductName); + + String actualProductName = product.getName(); + + assertEquals(expectedProductName, actualProductName, "Product name should match the set name"); + } + + @Test + public void testGetName_WhenNameIsNotSet() { + String actualProductName = product.getName(); + + assertEquals(null, actualProductName, "Product name should be null when it is not set"); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_getPrice_d2cb73a47d_Test.java b/src/test/java/com/bootexample4/products/model/Product_getPrice_d2cb73a47d_Test.java new file mode 100644 index 00000000..d78d46d2 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getPrice_d2cb73a47d_Test.java @@ -0,0 +1,36 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.model; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class Product_getPrice_d2cb73a47d_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testGetPrice_WhenPriceIsSet() { + double expectedPrice = 100.00; + product.setPrice(expectedPrice); + + double actualPrice = product.getPrice(); + + assertEquals(expectedPrice, actualPrice, "The actual price does not match the expected price"); + } + + @Test + public void testGetPrice_WhenPriceIsNotSet() { + double defaultPrice = 0.00; + + double actualPrice = product.getPrice(); + + assertEquals(defaultPrice, actualPrice, "The actual price does not match the default price"); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_setDescription_b4ccff923c_Test.java b/src/test/java/com/bootexample4/products/model/Product_setDescription_b4ccff923c_Test.java new file mode 100644 index 00000000..fec22859 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setDescription_b4ccff923c_Test.java @@ -0,0 +1,39 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.model; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +public class Product_setDescription_b4ccff923c_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testSetDescription_ValidDescription() { + String validDescription = "This is a valid product description."; + product.setDescription(validDescription); + assertEquals(validDescription, product.getDescription()); + } + + @Test + public void testSetDescription_EmptyDescription() { + String emptyDescription = ""; + product.setDescription(emptyDescription); + assertEquals(emptyDescription, product.getDescription()); + } + + @Test + public void testSetDescription_NullDescription() { + String nullDescription = null; + product.setDescription(nullDescription); + assertNull(product.getDescription()); + } + +} diff --git a/src/test/java/com/bootexample4/products/model/Product_setId_04a8e16b7c_Test.java b/src/test/java/com/bootexample4/products/model/Product_setId_04a8e16b7c_Test.java new file mode 100644 index 00000000..7014708b --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setId_04a8e16b7c_Test.java @@ -0,0 +1,30 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.model; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_setId_04a8e16b7c_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testSetId_Success() { + Long expectedId = 123L; + product.setId(expectedId); + assertEquals(expectedId, product.getId(), "The expected ID does not match the actual ID"); + } + + @Test + public void testSetId_Null() { + product.setId(null); + assertEquals(null, product.getId(), "The expected ID does not match the actual ID"); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_setName_5d23a892d9_Test.java b/src/test/java/com/bootexample4/products/model/Product_setName_5d23a892d9_Test.java new file mode 100644 index 00000000..39863434 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setName_5d23a892d9_Test.java @@ -0,0 +1,46 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.model; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Assertions; + +public class Product_setName_5d23a892d9_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testSetName() { + String expectedName = "Product1"; + product.setName(expectedName); + Assertions.assertEquals(expectedName, product.getName()); + } + + @Test + public void testSetName_Null() { + String expectedName = null; + product.setName(expectedName); + Assertions.assertEquals(expectedName, product.getName()); + } + + @Test + public void testSetName_Empty() { + String expectedName = ""; + product.setName(expectedName); + Assertions.assertEquals(expectedName, product.getName()); + } + + @Test + public void testSetName_LongString() { + // TODO: Change the string length according to your application's constraints + String expectedName = "A".repeat(101); + product.setName(expectedName); + Assertions.assertEquals(expectedName, product.getName()); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_setPrice_8f1e19b496_Test.java b/src/test/java/com/bootexample4/products/model/Product_setPrice_8f1e19b496_Test.java new file mode 100644 index 00000000..85300547 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setPrice_8f1e19b496_Test.java @@ -0,0 +1,40 @@ +// Test generated by RoostGPT for test endtoendunit using AI Type Open AI and AI Model gpt-4 + +package com.bootexample4.products.model; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_setPrice_8f1e19b496_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testSetPrice_PositiveValue() { + double expectedPrice = 100.0; + product.setPrice(expectedPrice); + assertEquals(expectedPrice, product.getPrice(), "The price should be set correctly for positive values"); + } + + @Test + public void testSetPrice_ZeroValue() { + double expectedPrice = 0.0; + product.setPrice(expectedPrice); + assertEquals(expectedPrice, product.getPrice(), "The price should be set correctly for zero value"); + } + + @Test + public void testSetPrice_NegativeValue() { + double expectedPrice = -100.0; + product.setPrice(expectedPrice); + assertEquals(expectedPrice, product.getPrice(), "The price should be set correctly for negative values"); + } + + // TODO: Add more tests for any other edge cases or special scenarios you can think of +} diff --git a/target/classes/application.properties b/target/classes/application.properties new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/target/classes/application.properties @@ -0,0 +1 @@ + diff --git a/target/classes/com/bootexample4/products/ProductsApplication.class b/target/classes/com/bootexample4/products/ProductsApplication.class new file mode 100644 index 00000000..6a52de87 Binary files /dev/null and b/target/classes/com/bootexample4/products/ProductsApplication.class differ diff --git a/target/classes/com/bootexample4/products/controller/ProductController.class b/target/classes/com/bootexample4/products/controller/ProductController.class new file mode 100644 index 00000000..0d818f3f Binary files /dev/null and b/target/classes/com/bootexample4/products/controller/ProductController.class differ diff --git a/target/classes/com/bootexample4/products/model/Product.class b/target/classes/com/bootexample4/products/model/Product.class new file mode 100644 index 00000000..0b02a5ee Binary files /dev/null and b/target/classes/com/bootexample4/products/model/Product.class differ diff --git a/target/classes/com/bootexample4/products/repository/ProductRepository.class b/target/classes/com/bootexample4/products/repository/ProductRepository.class new file mode 100644 index 00000000..359c7e3f Binary files /dev/null and b/target/classes/com/bootexample4/products/repository/ProductRepository.class differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 00000000..084b3671 --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=products +groupId=com.bootexample4 +version=0.0.1-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 00000000..3fc2fa99 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,4 @@ +com/bootexample4/products/model/Product.class +com/bootexample4/products/controller/ProductController.class +com/bootexample4/products/repository/ProductRepository.class +com/bootexample4/products/ProductsApplication.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 00000000..54e6bee7 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,4 @@ +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/main/java/com/bootexample4/products/model/Product.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/main/java/com/bootexample4/products/controller/ProductController.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/main/java/com/bootexample4/products/ProductsApplication.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/main/java/com/bootexample4/products/repository/ProductRepository.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 00000000..3786076d --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1,18 @@ +com/bootexample4/products/cucumber/SpringIntegrationTests.class +com/bootexample4/products/controller/ProductController_getAllProducts_7e38cc05f6_Test.class +com/bootexample4/products/model/Product_getPrice_d2cb73a47d_Test.class +com/bootexample4/products/model/Product_getDescription_b1844ea396_Test.class +com/bootexample4/products/controller/ProductController_getProductById_d22f3ea272_Test.class +com/bootexample4/products/model/Product_setId_04a8e16b7c_Test.class +com/bootexample4/products/cucumber/CucumberTestRunner.class +com/bootexample4/products/ProductsApplicationTests.class +com/bootexample4/products/cucumber/ProductStepDefinitions.class +com/bootexample4/products/model/Product_setPrice_8f1e19b496_Test.class +com/bootexample4/products/model/Product_setDescription_b4ccff923c_Test.class +com/bootexample4/products/TestMockServer.class +com/bootexample4/products/model/Product_setName_5d23a892d9_Test.class +com/bootexample4/products/controller/ProductController_deleteProduct_dcaff736d4_Test.class +com/bootexample4/products/controller/ProductController_updateProduct_9454a9af90_Test.class +com/bootexample4/products/model/Product_getId_ba349b1eff_Test.class +com/bootexample4/products/model/Product_getName_8400ac6fb7_Test.class +com/bootexample4/products/controller/ProductController_createProduct_36b748883e_Test.class diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 00000000..d73698b6 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1,18 @@ +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setName_5d23a892d9_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_d22f3ea272_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/TestMockServer.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/ProductsApplicationTests.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/ProductStepDefinitions.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/CucumberTestRunner.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getId_ba349b1eff_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_36b748883e_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setPrice_8f1e19b496_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getPrice_d2cb73a47d_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_9454a9af90_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_7e38cc05f6_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setId_04a8e16b7c_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setDescription_b4ccff923c_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_dcaff736d4_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/SpringIntegrationTests.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getName_8400ac6fb7_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/4215bb76-1971-4c8b-9fd6-c72658c25a8e/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getDescription_b1844ea396_Test.java diff --git a/target/products-0.0.1-SNAPSHOT.jar b/target/products-0.0.1-SNAPSHOT.jar new file mode 100644 index 00000000..43130b84 Binary files /dev/null and b/target/products-0.0.1-SNAPSHOT.jar differ diff --git a/target/products-0.0.1-SNAPSHOT.jar.original b/target/products-0.0.1-SNAPSHOT.jar.original new file mode 100644 index 00000000..df248f09 Binary files /dev/null and b/target/products-0.0.1-SNAPSHOT.jar.original differ diff --git a/target/surefire-reports/2023-08-12T12-31-36_611-jvmRun1.dump b/target/surefire-reports/2023-08-12T12-31-36_611-jvmRun1.dump new file mode 100644 index 00000000..a4c407b8 --- /dev/null +++ b/target/surefire-reports/2023-08-12T12-31-36_611-jvmRun1.dump @@ -0,0 +1,14 @@ +# Created at 2023-08-12T12:31:37.300 +System.exit() or native command error interrupted process checker. +java.lang.IllegalStateException: Cannot use PPID 1031 process information. Going to use NOOP events. + at org.apache.maven.surefire.booter.PpidChecker.checkProcessInfo(PpidChecker.java:155) + at org.apache.maven.surefire.booter.PpidChecker.isProcessAlive(PpidChecker.java:124) + at org.apache.maven.surefire.booter.ForkedBooter$2.run(ForkedBooter.java:214) + at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) + at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) + at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) + at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) + at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) + at java.base/java.lang.Thread.run(Thread.java:833) + + diff --git a/target/surefire-reports/TEST-com.bootexample4.products.model.Product_setPrice_8f1e19b496_Test.xml b/target/surefire-reports/TEST-com.bootexample4.products.model.Product_setPrice_8f1e19b496_Test.xml new file mode 100644 index 00000000..4461cba2 --- /dev/null +++ b/target/surefire-reports/TEST-com.bootexample4.products.model.Product_setPrice_8f1e19b496_Test.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/surefire-reports/com.bootexample4.products.model.Product_setPrice_8f1e19b496_Test.txt b/target/surefire-reports/com.bootexample4.products.model.Product_setPrice_8f1e19b496_Test.txt new file mode 100644 index 00000000..e6cf1876 --- /dev/null +++ b/target/surefire-reports/com.bootexample4.products.model.Product_setPrice_8f1e19b496_Test.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: com.bootexample4.products.model.Product_setPrice_8f1e19b496_Test +------------------------------------------------------------------------------- +Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.07 s - in com.bootexample4.products.model.Product_setPrice_8f1e19b496_Test diff --git a/target/test-classes/com/bootexample4/products/ProductsApplicationTests.class b/target/test-classes/com/bootexample4/products/ProductsApplicationTests.class new file mode 100644 index 00000000..c5b36d0e Binary files /dev/null and b/target/test-classes/com/bootexample4/products/ProductsApplicationTests.class differ diff --git a/target/test-classes/com/bootexample4/products/TestMockServer.class b/target/test-classes/com/bootexample4/products/TestMockServer.class new file mode 100644 index 00000000..fbdcd515 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/TestMockServer.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_createProduct_36b748883e_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_createProduct_36b748883e_Test.class new file mode 100644 index 00000000..0f014216 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_createProduct_36b748883e_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_deleteProduct_dcaff736d4_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_deleteProduct_dcaff736d4_Test.class new file mode 100644 index 00000000..c0172381 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_deleteProduct_dcaff736d4_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_getAllProducts_7e38cc05f6_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_getAllProducts_7e38cc05f6_Test.class new file mode 100644 index 00000000..3fe260a1 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_getAllProducts_7e38cc05f6_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_getProductById_d22f3ea272_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_getProductById_d22f3ea272_Test.class new file mode 100644 index 00000000..2c15f3ae Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_getProductById_d22f3ea272_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_updateProduct_9454a9af90_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_updateProduct_9454a9af90_Test.class new file mode 100644 index 00000000..cf7431e8 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_updateProduct_9454a9af90_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/cucumber/CucumberTestRunner.class b/target/test-classes/com/bootexample4/products/cucumber/CucumberTestRunner.class new file mode 100644 index 00000000..a1b08b2a Binary files /dev/null and b/target/test-classes/com/bootexample4/products/cucumber/CucumberTestRunner.class differ diff --git a/target/test-classes/com/bootexample4/products/cucumber/ProductStepDefinitions.class b/target/test-classes/com/bootexample4/products/cucumber/ProductStepDefinitions.class new file mode 100644 index 00000000..a4e69d7e Binary files /dev/null and b/target/test-classes/com/bootexample4/products/cucumber/ProductStepDefinitions.class differ diff --git a/target/test-classes/com/bootexample4/products/cucumber/SpringIntegrationTests.class b/target/test-classes/com/bootexample4/products/cucumber/SpringIntegrationTests.class new file mode 100644 index 00000000..273ecef2 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/cucumber/SpringIntegrationTests.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_getDescription_b1844ea396_Test.class b/target/test-classes/com/bootexample4/products/model/Product_getDescription_b1844ea396_Test.class new file mode 100644 index 00000000..5eb47d25 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_getDescription_b1844ea396_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_getId_ba349b1eff_Test.class b/target/test-classes/com/bootexample4/products/model/Product_getId_ba349b1eff_Test.class new file mode 100644 index 00000000..9ded72f6 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_getId_ba349b1eff_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_getName_8400ac6fb7_Test.class b/target/test-classes/com/bootexample4/products/model/Product_getName_8400ac6fb7_Test.class new file mode 100644 index 00000000..4967b2e2 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_getName_8400ac6fb7_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_getPrice_d2cb73a47d_Test.class b/target/test-classes/com/bootexample4/products/model/Product_getPrice_d2cb73a47d_Test.class new file mode 100644 index 00000000..a2097039 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_getPrice_d2cb73a47d_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_setDescription_b4ccff923c_Test.class b/target/test-classes/com/bootexample4/products/model/Product_setDescription_b4ccff923c_Test.class new file mode 100644 index 00000000..e8dc2a83 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_setDescription_b4ccff923c_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_setId_04a8e16b7c_Test.class b/target/test-classes/com/bootexample4/products/model/Product_setId_04a8e16b7c_Test.class new file mode 100644 index 00000000..3b0801d9 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_setId_04a8e16b7c_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_setName_5d23a892d9_Test.class b/target/test-classes/com/bootexample4/products/model/Product_setName_5d23a892d9_Test.class new file mode 100644 index 00000000..fd117b1c Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_setName_5d23a892d9_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_setPrice_8f1e19b496_Test.class b/target/test-classes/com/bootexample4/products/model/Product_setPrice_8f1e19b496_Test.class new file mode 100644 index 00000000..c9ca604e Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_setPrice_8f1e19b496_Test.class differ diff --git a/target/test-classes/features/sample.feature b/target/test-classes/features/sample.feature new file mode 100644 index 00000000..61fb017b --- /dev/null +++ b/target/test-classes/features/sample.feature @@ -0,0 +1,38 @@ +Feature: Product API + As a user of the product API + I want to be able to perform CRUD operations on products + So that I can manage my products effectively + + Background: + Given the base URL is "http://localhost:8080" + + Scenario: Get all products + When the client sends a GET request "/api/products" to get the list of all products + Then the list of products returned should be empty + + Scenario: Create a new product + Given the client provides the following product data: + | name | description | price | + | Test Product | This is a test product. | 10.0 | + When the client sends a POST request to "/api/products" + Then the saved product should not be null and its properties must correspond to those provided by client + + Scenario: Get a product by ID + Given there is an existing product with ID 1 + When the client sends a GET request "/api/products/1" to get a product by its id + Then the response status code should be 200 + And the response should contain the product with ID 1 + + Scenario: Update an existing product + Given there is an existing product with ID 1 + And the client provides the following product data: + | name | description | price | + | Updated Product | This is an updated test product. | 15.0 | + When the client sends a PUT request to "/api/products/1" + Then the product with ID 1 should be updated with the provided details + + Scenario: Delete an existing product + Given there is an existing product with ID 1 + When the client sends a DELETE request to "/api/products/1" + Then the response status code should be 200 + And the product with ID 1 should no longer exist