diff --git a/pom.xml b/pom.xml
index d5e071f9..cf9d3292 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,96 +1,153 @@
-
-
- 4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 3.0.6
-
-
- com.medeiros
- SPRINGProject
- 0.0.1-SNAPSHOT
- SPRINGProject
- Demo project for Spring Boot
-
- 20
-
- 6.0.3
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
-
- com.mysql
- mysql-connector-j
- runtime
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
- 3.0.6
-
-
-
- org.springframework.boot
- spring-boot-starter-security
-
-
-
- io.jsonwebtoken
- jjwt-api
- 0.11.5
-
-
-
-
-
-
- org.springframework.security
- spring-security-core
- 6.0.3
-
-
-
-
-
-
- io.jsonwebtoken
- jjwt-impl
- 0.11.5
- runtime
-
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.0.6
+
+
+
+ com.medeiros
+ SPRINGProject
+ 0.0.1-SNAPSHOT
+ SPRINGProject
+ Demo project for Spring Boot
+
+ 20
+
+ 6.0.3
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ runtime
+ true
+
+
+ com.mysql
+ mysql-connector-j
+ runtime
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+ 3.0.6
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+
+ io.jsonwebtoken
+ jjwt-api
+ 0.11.5
+
+
+
+ org.springframework.security
+ spring-security-core
+ 6.0.3
+
+
+
+
+ io.jsonwebtoken
+ jjwt-impl
+ 0.11.5
+ runtime
+
+
+ org.mockito
+ mockito-junit-jupiter
+ 2.23.4
+ test
+
+
+
+ io.spring.javaformat
+ spring-javaformat-formatter
+ 0.0.40
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.11
+
+
+
+ prepare-agent
+
+
+
+ report
+ test
+
+ report
+
+
+ coverageReport
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.5
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ 3.2.5
+
+ testReport
+
+
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ 2.1
+
+ testReport
+
+
+
+
+ io.spring.javaformat
+ spring-javaformat-maven-plugin
+ 0.0.40
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerCreateForumIndexTest.java b/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerCreateForumIndexTest.java
new file mode 100644
index 00000000..24f3eec1
--- /dev/null
+++ b/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerCreateForumIndexTest.java
@@ -0,0 +1,117 @@
+
+// ********RoostGPT********
+/*
+Test generated by RoostGPT for test maven-music-github using AI Type Azure Open AI and AI Model gpt-5
+
+ROOST_METHOD_HASH=createForumIndex_fec126ecbb
+ROOST_METHOD_SIG_HASH=createForumIndex_d46662bc78
+
+Scenario 1: Returns success message and persists forum with typical valid inputs
+
+Details:
+ TestName: returnsSuccessMessageAndPersistsForumWhenValidInput
+ Description: Validates that when provided with a non-empty name, a non-empty description, and a positive userId, the method constructs a forum entry, persists it via ForumIndexRepository.save, and returns the fixed success message.
+
+Execution:
+ Arrange: Set up a ForumController instance with ForumIndexRepository mocked to accept any ForumIndexModel; ensure LogRepository and ForumChatRepository are also mocked. Prepare inputs such as nameForum = "General", forumDescription = "General discussion", userId = 42.
+ Act: Invoke createForumIndex with the arranged inputs.
+ Assert:
+ - Assert that the returned value equals the exact string "Forum criado".
+ - Verify that ForumIndexRepository.save is called exactly once with any ForumIndexModel instance.
+ - Verify that there are no interactions with LogRepository and ForumChatRepository.
+
+Validation:
+ Confirms that the method’s primary behavior is to save a newly constructed forum and return a static success message. Ensures there are no side effects on unrelated components and that the method’s output is stable and predictable for valid input.
+
+*/
+
+// ********RoostGPT********
+
+package com.medeiros.SPRINGProject.Controllers;
+
+import com.medeiros.SPRINGProject.Models.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import com.medeiros.SPRINGProject.Controllers.ForumController;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.Mockito.*;
+import org.junit.jupiter.api.*;
+
+@ExtendWith(MockitoExtension.class)
+public class ForumControllerCreateForumIndexTest {
+
+ @Mock
+ private LogRepository Log;
+
+ @Mock
+ private ForumIndexRepository ForumIndexRepo;
+
+ @Mock
+ private ForumChatRepository ChatRepository;
+
+ @InjectMocks
+ private ForumController forumController;
+
+ @Test
+ @Tag("valid")
+ public void testReturnsSuccessMessageAndPersistsForumWhenValidInput() {
+ String nameForum = "General";
+ String forumDescription = "General discussion";
+ int userId = 42;
+ String actual = forumController.createForumIndex(nameForum, forumDescription, userId);
+ String expected = "Forum criado";
+ assertEquals((String) expected, (String) actual);
+ verify(ForumIndexRepo, times(1)).save(any(ForumIndexModel.class));
+ verifyNoMoreInteractions(ForumIndexRepo);
+ verifyNoInteractions(Log, ChatRepository);
+ }
+
+ @Test
+ @Tag("boundary")
+ public void testReturnsSuccessMessageAndPersistsForumWhenUserIdIsZero() {
+ String nameForum = "General";
+ String forumDescription = "General discussion";
+ int userId = 0;
+ String actual = forumController.createForumIndex(nameForum, forumDescription, userId);
+ String expected = "Forum criado";
+ assertEquals((String) expected, (String) actual);
+ verify(ForumIndexRepo, times(1)).save(any(ForumIndexModel.class));
+ verifyNoMoreInteractions(ForumIndexRepo);
+ verifyNoInteractions(Log, ChatRepository);
+ }
+
+ @Test
+ @Tag("invalid")
+ public void testReturnsSuccessMessageAndPersistsForumWhenUserIdIsNegative() {
+ String nameForum = "General";
+ String forumDescription = "General discussion";
+ int userId = -5; // TODO: Adjust if negative userId should be handled differently
+ String actual = forumController.createForumIndex(nameForum, forumDescription, userId);
+ String expected = "Forum criado";
+ assertEquals((String) expected, (String) actual);
+ verify(ForumIndexRepo, times(1)).save(any(ForumIndexModel.class));
+ verifyNoMoreInteractions(ForumIndexRepo);
+ verifyNoInteractions(Log, ChatRepository);
+ }
+
+ @Test
+ @Tag("boundary")
+ public void testReturnsSuccessMessageAndPersistsForumWhenNameAndDescriptionAreEmpty() {
+ String nameForum = "";
+ String forumDescription = "";
+ int userId = 7;
+ String actual = forumController.createForumIndex(nameForum, forumDescription, userId);
+ String expected = "Forum criado";
+ assertEquals((String) expected, (String) actual);
+ verify(ForumIndexRepo, times(1)).save(any(ForumIndexModel.class));
+ verifyNoMoreInteractions(ForumIndexRepo);
+ verifyNoInteractions(Log, ChatRepository);
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerNewMessageTest.java b/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerNewMessageTest.java
new file mode 100644
index 00000000..2c355700
--- /dev/null
+++ b/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerNewMessageTest.java
@@ -0,0 +1,72 @@
+
+// ********RoostGPT********
+/*
+Test generated by RoostGPT for test maven-music-github using AI Type Azure Open AI and AI Model gpt-5
+
+ROOST_METHOD_HASH=newMessage_7d9702b2ce
+ROOST_METHOD_SIG_HASH=newMessage_f58e857aa0
+
+Scenario 1: Valid message is saved and the same message is returned
+
+Details:
+ TestName: newMessageWithValidInputsReturnsOriginalMessage
+ Description: Verifies that when a non-empty message is sent with valid userId and forumId, the controller creates a ForumChatModel, calls ChatRepository.save once, and returns the exact same message string.
+
+Execution:
+ Arrange: Prepare a ForumController instance with ChatRepository mocked and injected. Provide message = "Hello World", userId = 42, forumId = 7. Ensure Log and ForumIndexRepo are also injected (can be mocks) but left unused.
+ Act: Invoke ForumController.newMessage("Hello World", 42, 7).
+ Assert: Use a JUnit equality assertion to confirm the returned string equals "Hello World". Verify via a mocking framework that ChatRepository.save was called exactly once with any ForumChatModel instance. Verify no interactions occurred with Log or ForumIndexRepo.
+
+Validation:
+ Confirms the controller's responsibility to persist a new chat message and return the same content without modification. Ensures correct repository usage and absence of unintended side effects on other injected repositories.
+
+*/
+
+// ********RoostGPT********
+
+package com.medeiros.SPRINGProject.Controllers;
+
+import com.medeiros.SPRINGProject.Models.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.Mockito;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
+import static org.mockito.Mockito.times;
+import org.junit.jupiter.api.*;
+
+@ExtendWith(MockitoExtension.class)
+public class ForumControllerNewMessageTest {
+
+ @Mock
+ private LogRepository Log;
+
+ @Mock
+ private ForumIndexRepository ForumIndexRepo;
+
+ @Mock
+ private ForumChatRepository ChatRepository;
+
+ @InjectMocks
+ private ForumController forumController;
+
+ @Test
+ @Tag("valid")
+ public void newMessageWithValidInputsReturnsOriginalMessage() {
+ String message = "Hello World"; // TODO customize test input message if needed
+ int userId = 42; // TODO customize test user id if needed
+ int forumId = 7; // TODO customize test forum id if needed
+ String result = forumController.newMessage(message, userId, forumId);
+ assertEquals((String) message, (String) result, "Returned message should match the input message");
+ verify(ChatRepository, times(1)).save(Mockito.any(ForumChatModel.class));
+ verifyNoInteractions(Log, ForumIndexRepo);
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerShowMessagesTest.java b/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerShowMessagesTest.java
new file mode 100644
index 00000000..46f5b6ca
--- /dev/null
+++ b/src/test/java/com/medeiros/SPRINGProject/Controllers/ForumControllerShowMessagesTest.java
@@ -0,0 +1,102 @@
+
+// ********RoostGPT********
+/*
+Test generated by RoostGPT for test maven-music-github using AI Type Azure Open AI and AI Model gpt-5
+
+ROOST_METHOD_HASH=showMessages_7de7018eb8
+ROOST_METHOD_SIG_HASH=showMessages_778e9dc544
+
+Scenario 1: Returns the same iterable from the repository when messages exist
+
+Details:
+ TestName: returnsAllMessagesWhenRepositoryHasEntries
+ Description: Verifies that showMessages delegates directly to ForumChatRepository.findAll and returns exactly the same Iterable instance when the repository contains messages.
+
+Execution:
+ Arrange: Create a ForumController with a mocked ForumChatRepository. Stub ChatRepository.findAll() to return a predefined Iterable containing multiple ForumChatModel instances.
+ Act: Invoke showMessages().
+ Assert: Check that the returned Iterable is the same instance as the one provided by the mock (reference equality). Verify ChatRepository.findAll() is invoked exactly once.
+
+Validation:
+ Confirms pass-through behavior with no transformation or additional processing. This ensures the controller method remains simple and predictable, returning whatever the repository provides.
+
+*/
+
+// ********RoostGPT********
+
+package com.medeiros.SPRINGProject.Controllers;
+
+import com.medeiros.SPRINGProject.Models.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.*;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.junit.jupiter.api.*;
+
+@ExtendWith(MockitoExtension.class)
+public class ForumControllerShowMessagesTest {
+
+ @Mock
+ private ForumChatRepository ChatRepository;
+
+ @InjectMocks
+ private ForumController controller;
+
+ @Test
+ @Tag("valid")
+ public void returnsAllMessagesWhenRepositoryHasEntries() {
+ List expected = Arrays.asList(new ForumChatModel("message1", 1, 101),
+ new ForumChatModel("message2", 2, 101));
+ when(ChatRepository.findAll()).thenReturn(expected);
+ Iterable actual = controller.showMessages();
+ assertSame((Iterable) expected, (Iterable) actual);
+ verify(ChatRepository, times(1)).findAll();
+ verifyNoMoreInteractions(ChatRepository);
+ }
+
+ @Test
+ @Tag("boundary")
+ public void returnsEmptyIterableWhenNoMessages() {
+ Iterable expected = Collections.emptyList();
+ when(ChatRepository.findAll()).thenReturn(expected);
+ Iterable actual = controller.showMessages();
+ assertSame((Iterable) expected, (Iterable) actual);
+ verify(ChatRepository, times(1)).findAll();
+ verifyNoMoreInteractions(ChatRepository);
+ }
+
+ @Test
+ @Tag("invalid")
+ public void propagatesExceptionWhenRepositoryThrows() {
+ RuntimeException repositoryException = new RuntimeException("Repository failure"); // TODO
+ // change
+ // message
+ // if
+ // needed
+ when(ChatRepository.findAll()).thenThrow(repositoryException);
+ RuntimeException thrown = assertThrows(RuntimeException.class, () -> controller.showMessages());
+ assertSame((Throwable) repositoryException, (Throwable) thrown);
+ verify(ChatRepository, times(1)).findAll();
+ verifyNoMoreInteractions(ChatRepository);
+ }
+
+ @Test
+ @Tag("invalid")
+ public void returnsNullWhenRepositoryReturnsNull() {
+ when(ChatRepository.findAll()).thenReturn(null);
+ Iterable actual = controller.showMessages();
+ assertNull((Iterable) actual);
+ verify(ChatRepository, times(1)).findAll();
+ verifyNoMoreInteractions(ChatRepository);
+ }
+
+}
\ No newline at end of file