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