diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java new file mode 100644 index 00000000..1b92edcb --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java @@ -0,0 +1,50 @@ +package com.bootexample4.products.controller; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.springframework.boot.test.context.SpringBootTest; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +@SpringBootTest +public class ProductController_createProduct_5fee6d5a95_Test { + + @InjectMocks + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + @Test + public void testCreateProductSuccess() { + Product product = new Product(); + product.setId(1L); + product.setName("Test Product"); + product.setDescription("Test Description"); + product.setPrice(100.0); + + when(productRepository.save(product)).thenReturn(product); + + Product result = productController.createProduct(product); + + assertEquals(product, result); + } + + @Test + public void testCreateProductFailure() { + Product product = new Product(); + product.setId(1L); + product.setName("Test Product"); + product.setDescription("Test Description"); + product.setPrice(100.0); + + when(productRepository.save(product)).thenReturn(null); + + Product result = productController.createProduct(product); + + assertEquals(null, result); + } +} diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java new file mode 100644 index 00000000..e5812990 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java @@ -0,0 +1,53 @@ +// 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.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +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_8aa83376b7_Test { + + @InjectMocks + ProductController productController; + + @Mock + ProductRepository productRepository; + + @BeforeEach + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testDeleteProduct_Success() { + Product product = new Product(); + product.setId(1L); + + when(productRepository.findById(1L)).thenReturn(Optional.of(product)); + + ResponseEntity responseEntity = productController.deleteProduct(1L); + + assertEquals(200, responseEntity.getStatusCodeValue()); + } + + @Test + public void testDeleteProduct_NotFound() { + when(productRepository.findById(1L)).thenReturn(Optional.empty()); + + ResponseEntity responseEntity = productController.deleteProduct(1L); + + assertEquals(404, responseEntity.getStatusCodeValue()); + } +} diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java new file mode 100644 index 00000000..b9570db3 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java @@ -0,0 +1,59 @@ +// 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 org.springframework.boot.test.context.SpringBootTest; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +@SpringBootTest +public class ProductController_getAllProducts_ce6c2f6265_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); // changed from int to Long + product1.setName("Product 1"); + + Product product2 = new Product(); + product2.setId(2L); // changed from int to Long + product2.setName("Product 2"); + + when(productRepository.findAll()).thenReturn(Arrays.asList(product1, product2)); + + List products = productController.getAllProducts(); + assertEquals(2, products.size()); + assertEquals(product1, products.get(0)); + assertEquals(product2, products.get(1)); + } + + @Test + public void testGetAllProducts_empty() { + when(productRepository.findAll()).thenReturn(Arrays.asList()); + + List products = productController.getAllProducts(); + assertEquals(0, products.size()); + } +} diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java new file mode 100644 index 00000000..bc181fce --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java @@ -0,0 +1,55 @@ +// 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.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +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_getProductById_079f0e7d67_Test { + + @InjectMocks + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + @BeforeEach + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGetProductById_Success() { + Product product = new Product(); + product.setId(1L); + product.setName("Product1"); + + when(productRepository.findById(1L)).thenReturn(Optional.of(product)); + + ResponseEntity responseEntity = productController.getProductById(1L); + + assertEquals(200, responseEntity.getStatusCodeValue()); + assertEquals(product, responseEntity.getBody()); + } + + @Test + public void testGetProductById_NotFound() { + when(productRepository.findById(1L)).thenReturn(Optional.empty()); + + ResponseEntity responseEntity = productController.getProductById(1L); + + assertEquals(404, responseEntity.getStatusCodeValue()); + } +} diff --git a/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java new file mode 100644 index 00000000..f2bb7a01 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java @@ -0,0 +1,70 @@ +// 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.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +import java.util.Optional; + +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 org.springframework.http.ResponseEntity; + +public class ProductController_updateProduct_d88ecc4aa9_Test { + + @InjectMocks + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + @BeforeEach + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testUpdateProduct_success() { + Product existingProduct = new Product(); + existingProduct.setId(1L); + existingProduct.setName("Old Product"); + existingProduct.setDescription("Old Description"); + existingProduct.setPrice(100.0); + + Product newProduct = new Product(); + newProduct.setName("New Product"); + newProduct.setDescription("New Description"); + newProduct.setPrice(200.0); + + when(productRepository.findById(1L)).thenReturn(Optional.of(existingProduct)); + when(productRepository.save(existingProduct)).thenReturn(existingProduct); + + ResponseEntity response = productController.updateProduct(1L, newProduct); + + assertEquals(200, response.getStatusCodeValue()); + assertEquals("New Product", response.getBody().getName()); + assertEquals("New Description", response.getBody().getDescription()); + assertEquals(200.0, response.getBody().getPrice()); + } + + @Test + public void testUpdateProduct_notFound() { + Product newProduct = new Product(); + newProduct.setName("New Product"); + newProduct.setDescription("New Description"); + newProduct.setPrice(200.0); + + when(productRepository.findById(1L)).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_ca387c4bd2_Test.java b/src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java new file mode 100644 index 00000000..9c58e938 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java @@ -0,0 +1,38 @@ +// 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.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +public class Product_getDescription_ca387c4bd2_Test { + + private Product product; + + @BeforeEach + public void setup() { + product = Mockito.mock(Product.class); + } + + @Test + public void testGetDescription_Success() { + // TODO: Change the value of description as per your requirement + String expectedDescription = "This is a test product"; + Mockito.when(product.getDescription()).thenReturn(expectedDescription); + + String actualDescription = product.getDescription(); + Assertions.assertEquals(expectedDescription, actualDescription); + } + + @Test + public void testGetDescription_Empty() { + // TODO: Change the value of description as per your requirement + String expectedDescription = ""; + Mockito.when(product.getDescription()).thenReturn(expectedDescription); + + String actualDescription = product.getDescription(); + Assertions.assertEquals(expectedDescription, actualDescription); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java b/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java new file mode 100644 index 00000000..ec87f970 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java @@ -0,0 +1,34 @@ +// 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; +import static org.junit.jupiter.api.Assertions.assertNull; + +public class Product_getId_eb19b6a6d6_Test { + + @InjectMocks + private Product product; + + @BeforeEach + public void setUp() { + MockitoAnnotations.openMocks(this); + } + + @Test + public void testGetIdWithNullId() { + assertNull(product.getId()); + } + + @Test + public void testGetIdWithNonNullId() { + Long expectedId = 1L; + product.setId(expectedId); + Long actualId = product.getId(); + assertEquals(expectedId, actualId); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java b/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java new file mode 100644 index 00000000..fe5f6ae0 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java @@ -0,0 +1,33 @@ +// 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_4ad76af4d7_Test { + + private Product product; + + @BeforeEach + public void setup() { + product = new Product(); + } + + @Test + public void testGetName_Success() { + String expectedName = "Product A"; + product.setName(expectedName); + String actualName = product.getName(); + assertEquals(expectedName, actualName, "The expected name does not match the actual name."); + } + + @Test + public void testGetName_Null() { + String expectedName = null; + product.setName(expectedName); + String actualName = product.getName(); + assertEquals(expectedName, actualName, "The expected name does not match the actual name."); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java b/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java new file mode 100644 index 00000000..3812bddd --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_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 org.mockito.Mockito; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_getPrice_d97185b3e6_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = Mockito.mock(Product.class); + } + + @Test + public void testGetPrice() { + // TODO: Set the price of the product here + double expectedPrice = 100.0; + Mockito.when(product.getPrice()).thenReturn(expectedPrice); + + double actualPrice = product.getPrice(); + + assertEquals(expectedPrice, actualPrice, "The expected price does not match the actual price"); + } + + @Test + public void testGetPrice_Zero() { + double expectedPrice = 0.0; + Mockito.when(product.getPrice()).thenReturn(expectedPrice); + + double actualPrice = product.getPrice(); + + assertEquals(expectedPrice, actualPrice, "The expected price does not match the actual price"); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java b/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java new file mode 100644 index 00000000..e368d77c --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java @@ -0,0 +1,34 @@ +// 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.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.MockitoAnnotations; + +public class Product_setDescription_5d6a2c2267_Test { + + @InjectMocks + private Product product; + + @BeforeEach + public void init() { + MockitoAnnotations.openMocks(this); + } + + @Test + public void testSetDescription() { + String expectedDescription = "This is a test product"; + product.setDescription(expectedDescription); + Assertions.assertEquals(expectedDescription, product.getDescription()); + } + + @Test + public void testSetDescriptionWithNull() { + String expectedDescription = null; + product.setDescription(expectedDescription); + Assertions.assertNull(product.getDescription()); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java b/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java new file mode 100644 index 00000000..14167817 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_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; +import static org.junit.jupiter.api.Assertions.assertNull; + +public class Product_setId_e7f341730a_Test { + + @InjectMocks + private Product product; + + @BeforeEach + public void setup() { + MockitoAnnotations.openMocks(this); + } + + @Test + public void testSetIdSuccess() { + Long expectedId = 123L; + product.setId(expectedId); + assertEquals(expectedId, product.getId()); + } + + @Test + public void testSetIdNull() { + product.setId(null); + assertNull(product.getId()); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java b/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java new file mode 100644 index 00000000..8fd21c20 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java @@ -0,0 +1,31 @@ +// 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_setName_f5bd015150_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testSetName_Success() { + String expectedName = "Test Product"; + product.setName(expectedName); + assertEquals(expectedName, product.getName()); + } + + @Test + public void testSetName_Null() { + String expectedName = null; + product.setName(expectedName); + assertEquals(expectedName, product.getName()); + } +} diff --git a/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.java b/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.java new file mode 100644 index 00000000..590f147a --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.java @@ -0,0 +1,33 @@ +// 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.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_setPrice_fa182f5c65_Test { + + @Test + public void testSetPricePositive() { + Product product = new Product(); + double expectedPrice = 200.0; + product.setPrice(expectedPrice); + assertEquals(expectedPrice, product.getPrice(), "The price should be set correctly for positive values"); + } + + @Test + public void testSetPriceNegative() { + Product product = new Product(); + double expectedPrice = -200.0; + product.setPrice(expectedPrice); + assertEquals(expectedPrice, product.getPrice(), "The price should be set correctly for negative values"); + } + + @Test + public void testSetPriceZero() { + Product product = new Product(); + double expectedPrice = 0.0; + product.setPrice(expectedPrice); + assertEquals(expectedPrice, product.getPrice(), "The price should be set correctly for zero value"); + } +} 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..77752260 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,4 @@ +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/main/java/com/bootexample4/products/ProductsApplication.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/main/java/com/bootexample4/products/controller/ProductController.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/main/java/com/bootexample4/products/repository/ProductRepository.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/main/java/com/bootexample4/products/model/Product.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..9a54f394 --- /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/model/Product_setName_f5bd015150_Test.class +com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.class +com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.class +com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.class +com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.class +com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.class +com/bootexample4/products/cucumber/CucumberTestRunner.class +com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.class +com/bootexample4/products/ProductsApplicationTests.class +com/bootexample4/products/cucumber/ProductStepDefinitions.class +com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.class +com/bootexample4/products/TestMockServer.class +com/bootexample4/products/model/Product_setId_e7f341730a_Test.class +com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.class +com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.class +com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.class +com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_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..e6f68aab --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1,18 @@ +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/ProductsApplicationTests.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/ProductStepDefinitions.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/TestMockServer.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/SpringIntegrationTests.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/e08395da-9b7f-4440-b263-06fea8a16327/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/CucumberTestRunner.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..c76f547d 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..0212c81d Binary files /dev/null and b/target/products-0.0.1-SNAPSHOT.jar.original differ diff --git a/target/surefire-reports/2023-08-07T03-39-20_755-jvmRun1.dump b/target/surefire-reports/2023-08-07T03-39-20_755-jvmRun1.dump new file mode 100644 index 00000000..3a883b68 --- /dev/null +++ b/target/surefire-reports/2023-08-07T03-39-20_755-jvmRun1.dump @@ -0,0 +1,14 @@ +# Created at 2023-08-07T03:39:21.480 +System.exit() or native command error interrupted process checker. +java.lang.IllegalStateException: Cannot use PPID 1125 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_fa182f5c65_Test.xml b/target/surefire-reports/TEST-com.bootexample4.products.model.Product_setPrice_fa182f5c65_Test.xml new file mode 100644 index 00000000..21c81370 --- /dev/null +++ b/target/surefire-reports/TEST-com.bootexample4.products.model.Product_setPrice_fa182f5c65_Test.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/surefire-reports/com.bootexample4.products.model.Product_setPrice_fa182f5c65_Test.txt b/target/surefire-reports/com.bootexample4.products.model.Product_setPrice_fa182f5c65_Test.txt new file mode 100644 index 00000000..69b98b78 --- /dev/null +++ b/target/surefire-reports/com.bootexample4.products.model.Product_setPrice_fa182f5c65_Test.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: com.bootexample4.products.model.Product_setPrice_fa182f5c65_Test +------------------------------------------------------------------------------- +Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.069 s - in com.bootexample4.products.model.Product_setPrice_fa182f5c65_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_5fee6d5a95_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.class new file mode 100644 index 00000000..68b94b3e Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.class new file mode 100644 index 00000000..907768f3 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.class new file mode 100644 index 00000000..79777c01 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.class new file mode 100644 index 00000000..9bf8f29d Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.class b/target/test-classes/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.class new file mode 100644 index 00000000..bbc8ed2a Binary files /dev/null and b/target/test-classes/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_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_ca387c4bd2_Test.class b/target/test-classes/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.class new file mode 100644 index 00000000..42873d8d Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.class b/target/test-classes/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.class new file mode 100644 index 00000000..d67e74dc Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.class b/target/test-classes/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.class new file mode 100644 index 00000000..85bc46d7 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.class b/target/test-classes/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.class new file mode 100644 index 00000000..6ed232ce Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.class b/target/test-classes/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.class new file mode 100644 index 00000000..ce25cca3 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_setId_e7f341730a_Test.class b/target/test-classes/com/bootexample4/products/model/Product_setId_e7f341730a_Test.class new file mode 100644 index 00000000..48c31c58 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_setId_e7f341730a_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_setName_f5bd015150_Test.class b/target/test-classes/com/bootexample4/products/model/Product_setName_f5bd015150_Test.class new file mode 100644 index 00000000..5669686f Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_setName_f5bd015150_Test.class differ diff --git a/target/test-classes/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.class b/target/test-classes/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.class new file mode 100644 index 00000000..c1dce528 Binary files /dev/null and b/target/test-classes/com/bootexample4/products/model/Product_setPrice_fa182f5c65_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