From 790f297ff184dae30dd59afc86c0f34016c24507 Mon Sep 17 00:00:00 2001 From: roost-io Date: Tue, 8 Aug 2023 10:39:23 +0000 Subject: [PATCH] Test generated by RoostGPT for test dmopensourcetest using AI Type Open Source AI and AI Model meta-llama/Llama-2-13b-chat --- ...troller_createProduct_5fee6d5a95_Test.java | 75 ++++++++++++++++++ ...troller_deleteProduct_8aa83376b7_Test.java | 13 +++ ...roller_getAllProducts_ce6c2f6265_Test.java | 61 ++++++++++++++ ...roller_getProductById_079f0e7d67_Test.java | 25 ++++++ ...troller_updateProduct_d88ecc4aa9_Test.java | 40 ++++++++++ ...roduct_getDescription_ca387c4bd2_Test.java | 26 ++++++ .../model/Product_getId_eb19b6a6d6_Test.java | 14 ++++ .../Product_getName_4ad76af4d7_Test.java | 11 +++ .../Product_getPrice_d97185b3e6_Test.java | 21 +++++ ...roduct_setDescription_5d6a2c2267_Test.java | 13 +++ .../model/Product_setId_e7f341730a_Test.java | 18 +++++ .../Product_setName_f5bd015150_Test.java | 18 +++++ .../Product_setPrice_fa182f5c65_Test.java | 17 ++++ target/classes/application.properties | 1 + .../products/ProductsApplication.class | Bin 0 -> 763 bytes .../controller/ProductController.class | Bin 0 -> 5205 bytes .../bootexample4/products/model/Product.class | Bin 0 -> 1487 bytes .../repository/ProductRepository.class | Bin 0 -> 368 bytes .../compile/default-compile/createdFiles.lst | 4 + .../compile/default-compile/inputFiles.lst | 4 + .../default-testCompile/createdFiles.lst | 0 .../default-testCompile/inputFiles.lst | 18 +++++ target/test-classes/features/sample.feature | 38 +++++++++ 23 files changed, 417 insertions(+) create mode 100644 src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java create mode 100644 src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java create mode 100644 src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java create mode 100644 src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java create mode 100644 src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java create mode 100644 src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java create mode 100644 src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java create mode 100644 src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java create mode 100644 src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java create mode 100644 src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java create mode 100644 src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java create mode 100644 src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java create mode 100644 src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.java create mode 100644 target/classes/application.properties create mode 100644 target/classes/com/bootexample4/products/ProductsApplication.class create mode 100644 target/classes/com/bootexample4/products/controller/ProductController.class create mode 100644 target/classes/com/bootexample4/products/model/Product.class create mode 100644 target/classes/com/bootexample4/products/repository/ProductRepository.class create mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst create mode 100644 target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst create mode 100644 target/test-classes/features/sample.feature 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..b882dd47 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java @@ -0,0 +1,75 @@ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.web.reactive.function.bodyToMono; + +public class ProductControllerTest { + + private WebTestClient.Builder testClientBuilder; + + @Autowired + public ProductControllerTest(WebTestClient.Builder testClientBuilder) { + this.testClientBuilder = testClientBuilder; + } + + @Before + public void setup() { + testClientBuilder.apply(this::configureMockMvc); + } + + private void configureMockMvc(WebTestClient.Builder builder) { + builder.mockMvc(new MockMvc(new WebApplicationContext())); + } + + @Test + public void testCreateProductSuccessful() { + // Arrange + Product product = new Product(); + product.setName("Test Product"); + product.setDescription("This is a test product."); + product.setPrice(19.99); + + // Act + ResponseEntity response = testClientBuilder.post() + .contentType(MediaType.APPLICATION_JSON) + .body(bodyToMono(product)) + .uri("/api/products") + .exchange(); + + // Assert + assertEquals(HttpStatus.OK, response.getStatusCode()); + assertNotNull(response.getBody()); + assertEquals(product.getName(), response.getBody().getName()); + } + + @Test + public void testCreateProductFailed() { + // Arrange + Product product = new Product(); + product.setName("Invalid Name"); + product.setDescription("This is a test product."); + product.setPrice(19.99); + + // Act + ResponseEntity response = testClientBuilder.post() + .contentType(MediaType.APPLICATION_JSON) + .body(bodyToMono(product)) + .uri("/api/products") + .exchange(); + + // Assert + assertEquals(HttpStatus.BAD_REQUEST, response.getStatusCode()); + assertNotNull(response.getBody()); + assertTrue(response.getBody().getMessage().contains("Invalid name")); + } +} 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..6583ae85 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java @@ -0,0 +1,13 @@ +@Test +public void testDeleteSuccessfulProduct() { + Long id = 1L; + ResponseEntity response = restTemplate.deleteProduct(id); + assertEquals(HttpStatus.OK, response.getStatusCode()); +} + +@Test +public void testDeleteNonExistentProduct() { + Long id = 9999L; + ResponseEntity response = restTemplate.deleteProduct(id); + assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode()); +} 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..7c726b7d --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java @@ -0,0 +1,61 @@ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebFlux; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import reactor.core.publisher.Mono; + +@RunWith(SpringRunner.class) +@SpringBootTest +@AutoConfigureWebFlux +public class ProductControllerTest { + + @Autowired + private ProductRepository productRepository; + + private RestTemplate restTemplate; + + @Before + public void setup() { + this.restTemplate = new MockRestTemplate(); + } + + @Test + public void testGetAllProductsSuccessful() { + // Arrange + List expectedResults = new ArrayList<>(); + expectedResults.add(new Product("Product 1", 10)); + expectedResults.add(new Product("Product 2", 20)); + when(productRepository.findAll()).thenReturn(expectedResults); + + // Act + Mono> response = restTemplate.exchange("/api/products", HttpMethod.GET, null, List.class); + + // Assert + assertEquals(HttpStatus.OK, response.statusCode()); + assertEquals(expectedResults, response.body()); + } + + @Test + public void testGetAllProductsFailed() { + // Arrange + when(productRepository.findAll()).thenThrow(new RuntimeException("Mock database exception")); + + // Act + Mono> response = restTemplate.exchange("/api/products", HttpMethod.GET, null, List.class); + + // Assert + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.statusCode()); + assertNull(response.body()); + } +} 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..d2e5915f --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java @@ -0,0 +1,25 @@ +@Test +public void testGetProductByIdSuccessful() { + Long id = 1L; + ResponseEntity response = restTemplate.exchange( + String.format("/products/%d", id), + HttpMethod.GET, + null, + Product.class); + assertThat(response).isNotNull(); + assertThat(response.getBody()).isNotNull(); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); +} + +@Test +public void testGetProductByIdNotFound() { + Long id = 99999L; + ResponseEntity response = restTemplate.exchange( + String.format("/products/%d", id), + HttpMethod.GET, + null, + Product.class); + assertThat(response).isNotNull(); + assertThat(response.getBody()).isNull(); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); +} 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..8513db64 --- /dev/null +++ b/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java @@ -0,0 +1,40 @@ +@Test +public void testUpdateProductSuccess() { + // Arrange + long id = 1L; + Product product = new Product(); + + // Act + ResponseEntity response = restTemplate.exchange( + "/api/products/" + id, + HttpMethod.PUT, + product, + Product.class + ); + + // Assert + assertEquals(HttpStatus.OK, response.getStatusCode()); + assertNotNull(response.getBody()); + assertEquals("Updated Name", response.getBody().getName()); + assertEquals("Updated Description", response.getBody().getDescription()); + assertEquals(10.99, response.getBody().getPrice(), 0.01); +} + +@Test +public void testUpdateProductNotFound() { + // Arrange + long id = 9999L; + Product product = new Product(); + + // Act + ResponseEntity response = restTemplate.exchange( + "/api/products/" + id, + HttpMethod.PUT, + product, + Product.class + ); + + // Assert + assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode()); + assertNull(response.getBody()); +} 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..97cfaf90 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java @@ -0,0 +1,26 @@ +@Test +public void testGetDescription_Success() { + // Arrange + Employee employee = new Employee(1L, "John Doe", "johndoe@example.com"); + employee.setDescription("A software engineer with 5 years of experience."); + + // Act + String result = employee.getDescription(); + + // Assert + assertEquals("A software engineer with 5 years of experience.", result); +} + +@Test +public void testGetDescription_Failure() { + // Arrange + Employee employee = new Employee(1L, "John Doe", "johndoe@example.com"); + + // Act + try { + String result = employee.getDescription(); + } catch (IllegalStateException e) { + // Assert + assertEquals("Employee has no description.", e.getMessage()); + } +} 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..f18459f1 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java @@ -0,0 +1,14 @@ +@Test +public void testGetId_Success() { + Long expectedId = 1L; + Entity entity = new Entity(1, "name", "description"); + when(entityRepository.findById(anyLong())).thenReturn(Optional.of(entity)); + assertEquals(expectedId, entityService.getId()); +} + +@Test +public void testGetId_Failure() { + Long expectedId = null; + when(entityRepository.findById(anyLong())).thenReturn(Optional.empty()); + assertNull(entityService.getId()); +} 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..718acc45 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java @@ -0,0 +1,11 @@ +@Test +public void testGetName_Success() { + Employee employee = new Employee(1L); + assertEquals("John Doe", employee.getName()); +} + +@Test +public void testGetName_Failure() { + Employee employee = new Employee(1L, null); + assertNull(employee.getName()); +} 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..26f46b47 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java @@ -0,0 +1,21 @@ +@Test +public void testGetPriceSuccess() { + // Arrange + Product product = new Product(); + product.setPrice(10.99); + // Act + double result = product.getPrice(); + // Assert + assertEquals(10.99, result, 0.01); +} + +@Test +public void testGetPriceFailure() { + // Arrange + Product product = new Product(); + product.setPrice(-1.00); + // Act + double result = product.getPrice(); + // Assert + assertEquals(-1.00, result, 0.01); +} 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..3b96cac8 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java @@ -0,0 +1,13 @@ +@Test +public void testSetDescriptionSuccess() { + Employee employee = new Employee(); + employee.setDescription("A software developer"); + assertEquals("A software developer", employee.getDescription()); +} + +@Test +public void testSetDescriptionFailureNullInput() { + Employee employee = new Employee(); + assertThrows(IllegalArgumentException.class, () -> employee.setDescription(null)); + assertEquals("", employee.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..070ea3f2 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java @@ -0,0 +1,18 @@ +@Test +public void testSetIdSuccessful() { + Employee employee = new Employee(); + Long id = 1L; + employee.setId(id); + assertEquals(id, employee.getId()); +} + +@Test +public void testSetIdFailure() { + Employee employee = new Employee(); + try { + employee.setId(null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + assertEquals("Invalid id", e.getMessage()); + } +} 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..932d5ad9 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java @@ -0,0 +1,18 @@ +@Test +public void testSetNameSuccess() { + Employee employee = new Employee(); + employee.setName("John Doe"); + assertEquals("John Doe", employee.getName()); +} + +@Test +public void testSetNameFailure() { + Employee employee = new Employee(); + try { + employee.setName(null); + fail(); + } catch (IllegalArgumentException e) { + assertEquals(" Cannot set null value for 'name'", e.getMessage()); + } + assertNull(employee.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..1a739f35 --- /dev/null +++ b/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.java @@ -0,0 +1,17 @@ +@Test +public void testSetPriceSuccessful() { + Product product = new Product(); + product.setPrice(10.99); + assertEquals(10.99, product.getPrice()); +} + +@Test +public void testSetPriceFailure() { + Product product = new Product(); + try { + product.setPrice(-10.99); + failBecauseNotReached(); + } catch (IllegalArgumentException e) { + assertEquals("Price cannot be negative", e.getMessage()); + } +} 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 0000000000000000000000000000000000000000..6a52de8756db622173acd982a8e8736528905552 GIT binary patch literal 763 zcmb7CO;6iE5PcgG970+kP|8Pp=q*Hoy`WywBGE`axh*0n95}6=#Vpvn)_Ps|TRpYv zp+BHM3Nh{U)Y3zHyhkEoiEbenE9FT#5rjxus1cOjpb+MTit1(|HxCvuzOx= zr!qNHh4K_=ZCo`T!Z>MU&JUQ2(ix(#qE0R*^oblb3deYdfVRkgEik`FB-iN1Ni))& z(NC}+m3y6}cY{(kNcR5)V1P}!tzZkU2*fA9ufTxrAQ=6^%H?yuUs=#n1z4?Nbg_-s XWZ$8`Lj;p*VYiZd*eC7Fz5$*9)bh!} literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..0d818f3f4360de16fbe361ebb64d283b3e3f1da6 GIT binary patch literal 5205 zcmcgwYj@Pf8GdGcS-i-X*kA|R25cN-8-oZqmu7(m+Yo3LaBb?eO>f%Wu`R5XHj>uh zrZj0vlk}Q4>HU7ceQM9?abrI8=pe+@s=$40-fhf+w?C8w2e>YlFwlT$FdmJ@Hoae`Nqua zuw49#Q585F(Fn%e36vDAZc6lVOk^>s;RL2AgyXL0Uez`2m1Wnc$lH#)rmy;bRbP-^ z)v-N!$@Wd3wD;MLf7z+ooc^<%K}x&PE7B-S*PE%C7E7+%Dd<_8*6;+*&^aCshGG^K zpumarR03hAH9V<&rqgjRS)S~Nz|(4do)LI$d=HP`D}M5O*fn`m-5qyXuYLyqvx-b! z;Khd~lU((kKA{}?yoL+-2sNOiOP`T*u$4P6DNnhmVFt4T8E1_`rPq3N#wl+!*8GxM z^UHMDw9B0^&tV8xG+f0;nG#l{f1O?`aG)MUL1-`f%7MASLnvsthU@I=)w?#$F6ueK z*$rV{!^aeC4`Jt|S8~lDZq=tn4L21`4`H@_TGH?$KEZ&X)x2w#$cDLiPFa0Q!%O%y zKhY}s)IL5pv9uqT@L3I?!{?c;ij+p+d@IeVoXBI7a(PnrWDv@|9 zb+^*FC=J`wmyMFj@468i=of3gbK7)fnXv7%On(Bs1=E(-Yn7sOZyJPW8Y(y?!&)+2 zQ`Mu!c7N3j#@jue?io0t^vvAIHR-Q9<#|J8 zYoD1_;K|g}oOis$JV%;cD28nErS#wn^5vTJd=iGV7O=IlMY{SsC4R0gm4*? z$-XbK!3PKe%MXwGV7}C`Zdf(?WQYEWS-#7iE4}E3zgmwQi&%W^K^PvQAGuhPcTsh4&x*gzYZW6&}x#j-Kl zL~)eooCiuFt&(?(BN>_2$7^z_(I*7%rcYV_6L0I4cX&!?I*pg9C*)X;8-^mSn)Afy zX@T6LQ*%r5vZ?l+!N{O-T{)!=#Jg>Bt&%%WvVOyyvbEkHTbl+st+B%0x=}UbYZX({ z46j?B?;6!GFMGY6_-+pG;N2{~r{Vkffxt-P7H8V)&YIK;kJQj!2Vwi+7yuWetQP*ph25X%xi!8fX@{Z1Di8Y<2 zVA(PG4~W0N9xamV7DzcEB=LSPHD7A8mp0G;8WxZu0NQZlPP?udF2z4ki$C z5rP@?xfPRI3s5ao&>o=95JA!JQK%=jFp$Cf7}}0}I6xi@dq&8Lu?>fus%Kc!Nei>4JBjUL2($ z!+ah|P#TUY4Pza*86u*eO5yc8cZ)4lB2F1y# z`*B1!l_!AziFSBA|9R17J9DW?4DHp<-@HiVQz zZC{JEEk@doB#7U~hg0xAgFc+a0OvT2GYN4=V%{UWiTmZ4>Fe8=2J26zeHj(9{HWId zg^1%o#PM7P@8P*E%q3k~{l^7NBgdP#3XIVC24XS;q4N=#nIQsxi$W_uIX!h^6VGqr z1y$bI#DXe6zKKt&0jKItew~A!+`?xvi9j0U`hz#xeVCvelX#T>e~e)&U@#eC#|%z~ z4AgjdlYx+7&m7+3TU%dFC9sIqG`|Fa%kd_+jTeUg(EvXT{ak7I8_EU% literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..0b02a5ee05870ce14a0af4a3efedc706d554c01b GIT binary patch literal 1487 zcma)6ZBG+H5T5Nja8Sxi6+u)$Xp3?R_z5L37EP0iM4Bdk+}>@4sSX(>OXcPSbwJLHWAtv=4N-8H4gP%P8gWu3$7bggI57j8Jn1&1=+@Equ$9JtbX7XD=F5 zq+5*AJx^LlXH`Z^@B5CDUD1@jY<0v-$8i;E}suuHdvs$tY~rSi}qgJC1+hr#*Mc&yyScHRng=GrIR z!y*)>!zhbt$H7__M(Rb20RR<4z~XStD6Xr{phR`BGh85LqV%K&A1*nSydH{_iAoUbZNS2@gcm;S%uy^1u3tFMO zxPS_AmC!m1EOZ4s0SG<~oU8CmSO%M}d?)rTfZfBX!y0-Yr|tm&I3^&&l-OpA*X!6=}|1F!Z@eRSWb`QITgk^RlsTc z22OhK*PP}9PCLQE!`&qi)Qi8Qg)jIqyt|!PPEY9R^_-HFL{6r%bwvx~oOZ!!?*>j< UgV&sjLEGKn+zWK9b+=FS2UINl+W-In literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..359c7e3f8685f1ce33b398a30b4f3fc8b3c23bca GIT binary patch literal 368 zcmbV|F;2rk5Jmq6f=SY($}yORq;a66h%AAU6HM%7Wykic#%oA=PDQ~1I26JJ5h4%` z#mq>*c=P{%eS3ZZaD`EXp1~}Yiq;~*Zn^TMy(F)awP|Qbt(PVbqC2|#)RqS&!l}Wy z;0LCXYe%>1!log@nZZ=lQR6kQ-Mw;UA4NBmabPMuA43~# z{)L?IIwTrJ~gW*bAP3=uycAh4`O1Sti*(EkO>89Vc3iJ@|_c;dp GJA4NaNO++D literal 0 HcmV?d00001 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..03306a72 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,4 @@ +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/main/java/com/bootexample4/products/controller/ProductController.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/main/java/com/bootexample4/products/model/Product.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/main/java/com/bootexample4/products/ProductsApplication.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/main/java/com/bootexample4/products/repository/ProductRepository.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 00000000..e69de29b 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..71ffeb97 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1,18 @@ +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setId_e7f341730a_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getAllProducts_ce6c2f6265_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setName_f5bd015150_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getName_4ad76af4d7_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setDescription_5d6a2c2267_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/TestMockServer.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_getProductById_079f0e7d67_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getPrice_d97185b3e6_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/SpringIntegrationTests.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_updateProduct_d88ecc4aa9_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getDescription_ca387c4bd2_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_createProduct_5fee6d5a95_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/ProductsApplicationTests.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/CucumberTestRunner.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/cucumber/ProductStepDefinitions.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/controller/ProductController_deleteProduct_8aa83376b7_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_getId_eb19b6a6d6_Test.java +/var/tmp/Roost/RoostGPT/dmopensourcetest/bd2a7256-4ac2-4639-9540-14990381b896/java-springbootunit/src/test/java/com/bootexample4/products/model/Product_setPrice_fa182f5c65_Test.java 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