Skip to content
Snippets Groups Projects
Commit 9a0048a9 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6751 Validierung zum Grpc Service hinzugefügt.

parent a3745232
Branches
Tags
No related merge requests found
......@@ -23,7 +23,10 @@ package de.ozgcloud.info.nachricht;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import java.util.Set;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.Validator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
......@@ -53,6 +56,9 @@ class NachrichtenGrpcServiceTest {
@Mock
private NachrichtMapper nachrichtenMapper;
@Mock
private Validator validator;
@Captor
private ArgumentCaptor<NachrichtEvent> nachrichtArgumentCaptor;
......@@ -67,6 +73,8 @@ class NachrichtenGrpcServiceTest {
void init() {
when(nachrichtenMapper.fromGrpcNachricht(newNachrichtRequest.getNachricht())).thenReturn(
NachrichtEventTestFactory.createNachrichtEventBuilder().id(null).build());
when(validator.validate(any(NachrichtEvent.class))).thenReturn(Set.of());
}
@Test
......
......@@ -26,6 +26,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTest;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.test.context.ContextConfiguration;
......@@ -39,6 +40,7 @@ import de.ozgcloud.info.common.NachrichtEvent;
@Testcontainers
@ContextConfiguration(classes = MongoDBTestContainerConfig.class)
public class NachrichtenRepositoryITCase {
@Qualifier("nachrichtRepository")
@Autowired
private NachrichtRepository repository;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment