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..9eccd5e2 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java @@ -0,0 +1,58 @@ +package com.bootexample4.products.controller; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.boot.test.context.SpringBootTest; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; +import static org.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.*; + +@RunWith(MockitoJUnitRunner.class) +@SpringBootTest +public class ProductController_createProduct_5fee6d5a95_Test { + + @InjectMocks + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + private Product product; + + @BeforeEach + public void setup() { + product = new Product(); + product.setId(1L); // Changed from 1 to 1L + product.setName("Test Product"); + product.setDescription("Test Product Description"); + product.setPrice(100.0); + } + + @Test + public void testCreateProduct_Success() { + when(productRepository.save(any(Product.class))).thenReturn(product); + + Product createdProduct = productController.createProduct(product); + + assertNotNull(createdProduct); + assertEquals(product.getId(), createdProduct.getId()); + assertEquals(product.getName(), createdProduct.getName()); + assertEquals(product.getDescription(), createdProduct.getDescription()); + assertEquals(product.getPrice(), createdProduct.getPrice()); + } + + @Test + public void testCreateProduct_Failure() { + when(productRepository.save(any(Product.class))).thenReturn(null); + + Product createdProduct = productController.createProduct(product); + + assertNull(createdProduct); + } +} 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..69df14f1 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java @@ -0,0 +1,56 @@ +package com.bootexample4.products.controller; + +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.verify; +import static org.junit.Assert.assertEquals; + +import java.util.Optional; + +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 com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; + +@RunWith(MockitoJUnitRunner.class) +public class ProductController_deleteProduct_8aa83376b7_Test { + + @InjectMocks + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + private Product product; + + @Before + public void setup() { + product = new Product(); + product.setId(1L); + } + + @Test + public void testDeleteProductSuccess() { + when(productRepository.findById(any(Long.class))).thenReturn(Optional.of(product)); + + ResponseEntity responseEntity = productController.deleteProduct(1L); + + verify(productRepository).deleteById(any(Long.class)); + assertEquals(200, responseEntity.getStatusCodeValue()); + } + + @Test + public void testDeleteProductNotFound() { + 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..2c27af8f --- /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 java.util.Arrays; +import java.util.List; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +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); + product1.setName("Product1"); + product1.setDescription("Description1"); + + Product product2 = new Product(); + product2.setId(2L); + product2.setName("Product2"); + product2.setDescription("Description2"); + + 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..6e7376ff --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_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.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.ResponseEntity; + +import com.bootexample4.products.model.Product; +import com.bootexample4.products.repository.ProductRepository; + +@SpringBootTest +public class ProductController_getProductById_079f0e7d67_Test { + + @InjectMocks + private ProductController productController; + + @Mock + private ProductRepository productRepository; + + @Test + public void testGetProductById_Found() { + Long id = 1L; // TODO: Change the product id as per your test data + Product product = new Product(); + product.setId(id); + product.setName("Test Product"); + + when(productRepository.findById(id)).thenReturn(Optional.of(product)); + + ResponseEntity responseEntity = productController.getProductById(id); + + assertEquals(200, responseEntity.getStatusCodeValue()); + assertEquals(product, responseEntity.getBody()); + } + + @Test + public void testGetProductById_NotFound() { + Long id = 1L; // TODO: Change the product id as per your test data + + when(productRepository.findById(id)).thenReturn(Optional.empty()); + + ResponseEntity responseEntity = productController.getProductById(id); + + 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..cb5f73b8 --- /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 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_updateProduct_d88ecc4aa9_Test { + + @InjectMocks + ProductController productController; + + @Mock + 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..becff92e --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java @@ -0,0 +1,32 @@ +// 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.springframework.boot.test.context.SpringBootTest; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@SpringBootTest +public class Product_getDescription_ca387c4bd2_Test { + + private Product product; + + @BeforeEach + public void setup() { + product = new Product(); + } + + @Test + public void testGetDescription_withDescription() { + String expectedDescription = "This is a test product."; + product.setDescription(expectedDescription); + assertEquals(expectedDescription, product.getDescription()); + } + + @Test + public void testGetDescription_withoutDescription() { + String expectedDescription = null; // TODO: Change this value to match your expected outcome + assertEquals(expectedDescription, product.getDescription()); + } +} 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..668afb38 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_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_getId_eb19b6a6d6_Test { + + @InjectMocks + private Product product; + + @BeforeEach + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testGetId_Success() { + Long expectedId = 123L; + product.setId(expectedId); + Long actualId = product.getId(); + assertEquals(expectedId, actualId, "The ID returned by getId() didn't match the expected value."); + } + + @Test + public void testGetId_Null() { + product.setId(null); + Long actualId = product.getId(); + assertEquals(null, actualId, "The ID returned by getId() should have been null but it wasn't."); + } +} 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..4d39c1bc --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java @@ -0,0 +1,34 @@ +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.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.mockito.Mockito; + +@SpringBootTest +public class Product_getName_4ad76af4d7_Test { + + @MockBean + private Product product; + + @BeforeEach + public void setUp() { + Mockito.when(product.getName()).thenReturn("Test Product"); + } + + @Test + public void testGetName_Success() { + String expectedName = "Test Product"; + String actualName = product.getName(); + Assertions.assertEquals(expectedName, actualName, "The expected name does not match the actual name"); + } + + @Test + public void testGetName_Failure() { + String unexpectedName = "Wrong Product"; + String actualName = product.getName(); + Assertions.assertNotEquals(unexpectedName, actualName, "The unexpected name matches 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..f71c4c3d --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_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 org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_getPrice_d97185b3e6_Test { + + private Product product; + + @BeforeEach + public void setup() { + MockitoAnnotations.initMocks(this); + product = new Product(); + } + + @Test + public void testGetPrice_PositiveValue() { + double expectedPrice = 100.0; + product.setPrice(expectedPrice); + double actualPrice = product.getPrice(); + assertEquals(expectedPrice, actualPrice, "Expected and actual price should match"); + } + + @Test + public void testGetPrice_ZeroValue() { + double expectedPrice = 0.0; + product.setPrice(expectedPrice); + double actualPrice = product.getPrice(); + assertEquals(expectedPrice, actualPrice, "Expected and actual price should match when price is zero"); + } + + @Test + public void testGetPrice_NegativeValue() { + double expectedPrice = -10.0; + product.setPrice(expectedPrice); + double actualPrice = product.getPrice(); + assertEquals(expectedPrice, actualPrice, "Expected and actual price should match when price is negative"); + } +} 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..c8dab1b2 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_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 org.mockito.Mock; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class Product_setDescription_5d6a2c2267_Test { + + private Product product; + + @BeforeEach + public void setup() { + product = new Product(); + } + + @Test + public void testSetDescriptionSuccess() { + String description = "This is a test product description"; + product.setDescription(description); + assertEquals(description, product.getDescription()); + } + + @Test + public void testSetDescriptionEmpty() { + String description = ""; + product.setDescription(description); + assertEquals(description, product.getDescription()); + } + + @Test + public void testSetDescriptionNull() { + String description = null; + product.setDescription(description); + assertEquals(description, product.getDescription()); + } + + // TODO: Add more test cases as per the real scenarios and requirements +} 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..15891b34 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java @@ -0,0 +1,34 @@ +package com.bootexample4.products.model; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeEach; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; // added this import statement + +public class Product_setId_e7f341730a_Test { + + @Mock + private Product product; + + @BeforeEach + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testSetIdSuccess() { + Long expectedId = 100L; + product.setId(expectedId); + assertEquals(expectedId, product.getId(), "The expected ID does not match the actual ID"); + } + + @Test + public void testSetIdFailure() { + Long unexpectedId = 200L; + product.setId(100L); + assertNotEquals(unexpectedId, product.getId(), "The unexpected ID matches the actual ID"); + } +} 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..9748ce7b --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java @@ -0,0 +1,32 @@ +// 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.Mockito; + +public class Product_setName_f5bd015150_Test { + + private Product product; + + @BeforeEach + public void setUp() { + product = new Product(); + } + + @Test + public void testSetName() { + String expectedName = "TestProduct"; + product.setName(expectedName); + Assertions.assertEquals(expectedName, product.getName()); + } + + @Test + public void testSetNameWithNull() { + String expectedName = null; + product.setName(expectedName); + Assertions.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..c710dabf --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_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 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_positiveNumber() { + double price = 100.0; + product.setPrice(price); + assertEquals(price, product.getPrice(), "Price should be set to the positive number"); + } + + @Test + public void testSetPrice_zero() { + double price = 0.0; + product.setPrice(price); + assertEquals(price, product.getPrice(), "Price should be set to zero"); + } + + @Test + public void testSetPrice_negativeNumber() { + double price = -100.0; + product.setPrice(price); + assertEquals(price, product.getPrice(), "Price should be set to the negative number"); + } +} 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..0cefa454 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,4 @@ +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/main/java/com/bootexample4/products/ProductsApplication.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/main/java/com/bootexample4/products/controller/ProductController.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/main/java/com/bootexample4/products/repository/ProductRepository.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/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..14102cd7 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1,18 @@ +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/ProductStepDefinitions.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/ProductsApplicationTests.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/SpringIntegrationTests.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/TestMockServer.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/CucumberTestRunner.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java +/var/tmp/Roost/RoostGPT/endtoendunit/17a6faee-8f98-4ee0-a2be-49ba7389e5cd/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_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..418c2085 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..03a11c00 Binary files /dev/null and b/target/products-0.0.1-SNAPSHOT.jar.original differ diff --git a/target/surefire-reports/2023-08-09T14-52-37_887-jvmRun1.dump b/target/surefire-reports/2023-08-09T14-52-37_887-jvmRun1.dump new file mode 100644 index 00000000..461e9c76 --- /dev/null +++ b/target/surefire-reports/2023-08-09T14-52-37_887-jvmRun1.dump @@ -0,0 +1,14 @@ +# Created at 2023-08-09T14:52:38.583 +System.exit() or native command error interrupted process checker. +java.lang.IllegalStateException: Cannot use PPID 1047 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..56a8aa8c --- /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..09151799 --- /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.11 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..ea4526a5 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..88226c8b 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..f5a300ad 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..eea63ed7 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..38692963 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..87301af8 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..7bb9c5f1 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..db0cc436 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..506ec64d 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..032209ec 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..ad75bd25 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..f7d99383 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..fd946068 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