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..b0de7b4e --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java @@ -0,0 +1,52 @@ +package com.bootexample4.products.controller; + +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 static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; + +public class ProductController_createProduct_5fee6d5a95_Test { + + @InjectMocks + ProductController productController; + + @Mock + ProductRepository productRepository; + + @BeforeEach + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testCreateProduct() { + + 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(product)).thenReturn(product); + + Product result = productController.createProduct(product); + + assertEquals(product, result); + } + + @Test + public void testCreateProductWithNull() { + Product product = null; + when(productRepository.save(product)).thenReturn(product); + + Product result = productController.createProduct(product); + + assertEquals(product, 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..052e5025 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_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.ArgumentMatchers.any; +import static org.mockito.Mockito.doNothing; +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 + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + private Product product; + + @BeforeEach + public void setup() { + MockitoAnnotations.initMocks(this); + product = new Product(); + product.setId(1L); + } + + @Test + public void testDeleteProduct_Success() { + 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_ce6c2f6265_Test.java b/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java new file mode 100644 index 00000000..a920d971 --- /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 java.util.Arrays; +import java.util.List; +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.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; + +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("Product1"); + product1.setDescription("Description1"); + product1.setPrice(100.0); + + Product product2 = new Product(); + product2.setId(2L); // Changed from int to Long + product2.setName("Product2"); + product2.setDescription("Description2"); + product2.setPrice(200.0); + + when(productRepository.findAll()).thenReturn(Arrays.asList(product1, product2)); + + List productList = productController.getAllProducts(); + assertEquals(2, productList.size()); + verify(productRepository, times(1)).findAll(); + } + + @Test + public void testGetAllProducts_Empty() { + when(productRepository.findAll()).thenReturn(Arrays.asList()); + + List productList = productController.getAllProducts(); + assertEquals(0, productList.size()); + verify(productRepository, times(1)).findAll(); + } +} 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..c8466af7 --- /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 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.HttpStatus; +import org.springframework.http.ResponseEntity; + +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +public class ProductController_getProductById_079f0e7d67_Test { + + @InjectMocks + ProductController productController; + + @Mock + ProductRepository productRepository; + + @BeforeEach + public void setup() { + MockitoAnnotations.openMocks(this); + } + + @Test + public void testGetProductById_found() { + Product product = new Product(); + product.setId(1L); + product.setName("Test Product"); + + when(productRepository.findById(1L)).thenReturn(Optional.of(product)); + + ResponseEntity responseEntity = productController.getProductById(1L); + + assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); + assertEquals(product, responseEntity.getBody()); + } + + @Test + public void testGetProductById_notFound() { + when(productRepository.findById(1L)).thenReturn(Optional.empty()); + + ResponseEntity responseEntity = productController.getProductById(1L); + + assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode()); + } +} 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..7f7d9a61 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java @@ -0,0 +1,74 @@ +// 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.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.http.ResponseEntity; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; + +import java.util.Optional; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class ProductController_updateProduct_d88ecc4aa9_Test { + + @InjectMocks + ProductController productController; + + @Mock + ProductRepository productRepository; + + @Before + public void setup() { + MockHttpServletRequest request = new MockHttpServletRequest(); + RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request)); + } + + @Test + public void testUpdateProductSuccess() { + Product existingProduct = new Product(); + existingProduct.setId(1L); + existingProduct.setName("Old Product"); + existingProduct.setDescription("Old Description"); + existingProduct.setPrice(100.00); + + Product newProduct = new Product(); + newProduct.setName("New Product"); + newProduct.setDescription("New Description"); + newProduct.setPrice(200.00); + + when(productRepository.findById(1L)).thenReturn(Optional.of(existingProduct)); + when(productRepository.save(existingProduct)).thenReturn(newProduct); + + ResponseEntity responseEntity = productController.updateProduct(1L, newProduct); + + assertEquals(200, responseEntity.getStatusCodeValue()); + assertEquals(newProduct, responseEntity.getBody()); + } + + @Test + public void testUpdateProductNotFound() { + Product newProduct = new Product(); + newProduct.setName("New Product"); + newProduct.setDescription("New Description"); + newProduct.setPrice(200.00); + + when(productRepository.findById(1L)).thenReturn(Optional.empty()); + + ResponseEntity responseEntity = productController.updateProduct(1L, newProduct); + + assertEquals(404, responseEntity.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..66876754 --- /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.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Assertions; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; + +public class Product_getDescription_ca387c4bd2_Test { + + @Mock + private Product product; + + @BeforeEach + public void setup() { + MockitoAnnotations.openMocks(this); + } + + @Test + public void testGetDescription_Success() { + String expectedDescription = "Test Product Description"; + Mockito.when(product.getDescription()).thenReturn(expectedDescription); + + String actualDescription = product.getDescription(); + Assertions.assertEquals(expectedDescription, actualDescription); + } + + @Test + public void testGetDescription_Null() { + Mockito.when(product.getDescription()).thenReturn(null); + + String actualDescription = product.getDescription(); + Assertions.assertNull(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..3e2001e4 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java @@ -0,0 +1,35 @@ +package com.bootexample4.products.model; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import static org.mockito.Mockito.*; + +public class Product_getId_eb19b6a6d6_Test { + + @Mock + private Product product; + + @BeforeEach + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGetIdSuccess() { + Long expectedId = 123L; + when(product.getId()).thenReturn(expectedId); + Long actualId = product.getId(); + assertEquals(expectedId, actualId, "The expected ID does not match the actual ID."); + } + + @Test + public void testGetIdNull() { + when(product.getId()).thenReturn(null); + Long actualId = product.getId(); + assertNull(actualId, "The ID should be null."); + } +} 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..e43f9984 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java @@ -0,0 +1,37 @@ +// 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_getName_4ad76af4d7_Test { + + @InjectMocks + private Product product; + + @BeforeEach + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGetName() { + String expectedName = "TestProduct"; + product.setName(expectedName); + String actualName = product.getName(); + assertEquals(expectedName, actualName, "Expected name doesn't match with actual name"); + } + + @Test + public void testGetNameWithNull() { + String expectedName = null; + product.setName(expectedName); + String actualName = product.getName(); + assertEquals(expectedName, actualName, "Expected name doesn't match with 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..c415de8c --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java @@ -0,0 +1,41 @@ +// 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_getPrice_d97185b3e6_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testGetPrice_WithPositiveValue() { + double expectedPrice = 100.0; + product.setPrice(expectedPrice); // TODO: Change the value to test with different positive numbers + double actualPrice = product.getPrice(); + assertEquals(expectedPrice, actualPrice, "The expected price does not match the actual price"); + } + + @Test + public void testGetPrice_WithZero() { + double expectedPrice = 0.0; + product.setPrice(expectedPrice); // TODO: Change the value to test with zero + double actualPrice = product.getPrice(); + assertEquals(expectedPrice, actualPrice, "The expected price does not match the actual price"); + } + + @Test + public void testGetPrice_WithNegativeValue() { + double expectedPrice = -50.0; + product.setPrice(expectedPrice); // TODO: Change the value to test with different negative numbers + 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..4c9f9cc0 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_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 static org.junit.jupiter.api.Assertions.*; + +public class Product_setDescription_5d6a2c2267_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_NullDescription() { + String nullDescription = null; + product.setDescription(nullDescription); + assertNull(product.getDescription()); + } + + @Test + public void testSetDescription_EmptyDescription() { + String emptyDescription = ""; + product.setDescription(emptyDescription); + assertEquals(emptyDescription, product.getDescription()); + } + + @Test + public void testSetDescription_LongDescription() { + // TODO: Replace the following string with a string that exceeds the maximum length allowed for a product description. + String longDescription = "This is a long product description that exceeds the maximum length allowed for a product description."; + product.setDescription(longDescription); + assertEquals(longDescription, 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..2461770a --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java @@ -0,0 +1,44 @@ +// 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_e7f341730a_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testSetId_PositiveNumber() { + Long id = 1L; + product.setId(id); + assertEquals(id, product.getId(), "The id should be set correctly"); + } + + @Test + public void testSetId_NegativeNumber() { + Long id = -1L; + product.setId(id); + assertEquals(id, product.getId(), "The id should be set correctly even if it's negative"); + } + + @Test + public void testSetId_Zero() { + Long id = 0L; + product.setId(id); + assertEquals(id, product.getId(), "The id should be set correctly even if it's zero"); + } + + @Test + public void testSetId_Null() { + product.setId(null); + assertEquals(null, product.getId(), "The id should be set to null correctly"); + } +} 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..754b3928 --- /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..b0dbc842 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_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.Test; +import org.junit.jupiter.api.BeforeEach; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_setPrice_fa182f5c65_Test { + private Product product; + + @BeforeEach + public void setup() { + product = new Product(); + } + + @Test + public void testSetPrice_Positive() { + product.setPrice(100.50); + assertEquals(100.50, product.getPrice(), "Prices should match"); + } + + @Test + public void testSetPrice_Zero() { + product.setPrice(0); + assertEquals(0, product.getPrice(), "Prices should match"); + } + + @Test + public void testSetPrice_Negative() { + product.setPrice(-100.50); + assertEquals(-100.50, product.getPrice(), "Prices should match"); + } +} 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..851ca655 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,4 @@ +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/main/java/com/bootexample4/products/model/Product.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/main/java/com/bootexample4/products/controller/ProductController.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/main/java/com/bootexample4/products/repository/ProductRepository.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/main/java/com/bootexample4/products/ProductsApplication.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..ae27b9cc --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1,18 @@ +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/TestMockServer.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/ProductsApplicationTests.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/SpringIntegrationTests.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/CucumberTestRunner.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/ab568ce9-44b7-4f22-9f85-dd3e0a335538/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/ProductStepDefinitions.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..137ac8e4 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..9162ad99 Binary files /dev/null and b/target/products-0.0.1-SNAPSHOT.jar.original differ diff --git a/target/surefire-reports/2023-08-07T02-27-46_866-jvmRun1.dump b/target/surefire-reports/2023-08-07T02-27-46_866-jvmRun1.dump new file mode 100644 index 00000000..090d7073 --- /dev/null +++ b/target/surefire-reports/2023-08-07T02-27-46_866-jvmRun1.dump @@ -0,0 +1,14 @@ +# Created at 2023-08-07T02:27:47.491 +System.exit() or native command error interrupted process checker. +java.lang.IllegalStateException: Cannot use PPID 1057 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..2cf42c16 --- /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..0978ef0f --- /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.067 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..231f7655 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..8a1a18c9 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..f80acddb 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..5fc431be 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..d371deba 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..af24df86 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..8fe1f996 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..197f6a07 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..4a5e3168 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..1f1dac57 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..5d5644c8 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..b635ca31 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