RolePlay/src/test/java/de/neitzel/roleplay/business/GreetingServiceTest.java
Konrad Neitzel eed9d1da66 Add initial project structure and configuration for RolePlay service
- Create .gitignore to exclude target and IDE files
- Add application.yml for Quarkus configuration
- Implement package-info.java for business logic, facade, data, and common packages
- Define core classes for handling user actions, character states, and narrative suggestions
- Set up Ollama API client for narrative generation and state updates
- Include unit tests for greeting service and serialization of context
2026-02-20 13:41:24 +01:00

40 lines
991 B
Java

package de.neitzel.roleplay.business;
import de.neitzel.roleplay.common.GreetingFormatter;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
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.when;
/**
* Unit tests for {@link GreetingService}.
*/
@ExtendWith(MockitoExtension.class)
class GreetingServiceTest {
@Mock
private GreetingFormatter greetingFormatter;
@InjectMocks
private GreetingService greetingService;
/**
* Verifies that the service delegates to the formatter.
*/
@Test
void greetReturnsFormattedMessage() {
// Arrange
when(greetingFormatter.format("Ada")).thenReturn("Hello, Ada!");
// Act
String result = greetingService.greet("Ada");
// Assert
assertEquals("Hello, Ada!", result);
}
}