Skip to content

Commit

Permalink
Pull Request requested changes adjusted
Browse files Browse the repository at this point in the history
  • Loading branch information
pepataki authored and Ollitod committed Jul 26, 2024
1 parent 17b3f5f commit d8ea530
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/openjdk-17:latest
FROM registry.access.redhat.com/ubi9/openjdk-17:1.20-2.1721231695
ENV TZ="Europe/Vienna"

USER jboss
Expand Down
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.version>3.8.1</maven.version>

<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-io.version>2.11.0</commons-io.version>
<guava.version>33.2.1-jre</guava.version>

<quarkus-plugin.version>3.12.1</quarkus-plugin.version>
Expand Down Expand Up @@ -223,11 +221,6 @@
<artifactId>jakarta.mail-api</artifactId>
<version>${jakarta.mail-api.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-mail</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class NotificationHelperTest {
NotificationHelper notificationHelper;

@InjectMock
@MockitoConfig (returnsDeepMocks = true)
@MockitoConfig (returnsDeepMocks = true)
private NotificationConfig notificationConfig;

@InjectMock
@MockitoConfig (returnsDeepMocks = true)
@MockitoConfig (returnsDeepMocks = true)
private ResourceBundleProducer resourceBundleProducer;

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.gepardec.mega.notification.mail.receiver;

import com.gepardec.mega.application.configuration.MailReceiverConfig;
import com.sun.mail.imap.IMAPMessage;
import io.quarkus.test.InjectMock;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
Expand Down Expand Up @@ -50,7 +49,7 @@ void retrieveZepEmailsFromInbox_Successful() throws MessagingException {
//GIVEN
try (var mockedStatic = Mockito.mockStatic(Session.class)) {
var inbox = mock(Folder.class);
when(inbox.search(any())).thenReturn(new Message[]{mock(IMAPMessage.class)});
when(inbox.search(any())).thenReturn(new Message[]{mock(Message.class)});

var store = mock(Store.class);
when(store.getFolder(anyString())).thenReturn(inbox);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import com.gepardec.mega.service.api.CommentService;
import com.gepardec.mega.service.api.ProjectService;
import com.gepardec.mega.service.api.UserService;
import com.sun.mail.imap.IMAPMessage;
import io.quarkus.test.InjectMock;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import jakarta.mail.Message;
import jakarta.mail.MessagingException;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
Expand Down Expand Up @@ -74,7 +74,7 @@ void saveAsComment_BillableProject_Successful() throws MessagingException, IOExc
);

//WHEN
testedObject.saveAsComment(mock(IMAPMessage.class));
testedObject.saveAsComment(mock(Message.class));

//THEN
verify(commentService, times(1)).create(
Expand Down Expand Up @@ -106,7 +106,7 @@ void saveAsComment_NotBillableProject_Successful() throws MessagingException, IO
);

//WHEN
testedObject.saveAsComment(mock(IMAPMessage.class));
testedObject.saveAsComment(mock(Message.class));

//THEN
verify(commentService, times(1)).create(
Expand All @@ -131,7 +131,7 @@ void saveAsComment_ExceptionInMapper_ErrorLogged() throws MessagingException, IO

//WHEN
//THEN
assertThatCode(() -> testedObject.saveAsComment(mock(IMAPMessage.class)))
assertThatCode(() -> testedObject.saveAsComment(mock(Message.class)))
.doesNotThrowAnyException();
verify(logger).error(any());
verify(commentService, times(0)).create(any(), any(), any(), any(), any(), any(), any());
Expand All @@ -148,7 +148,7 @@ void saveAsComment_ExceptionInMapper_EmailSent() throws MessagingException, IOEx

//WHEN
//THEN
assertThatCode(() -> testedObject.saveAsComment(mock(IMAPMessage.class)))
assertThatCode(() -> testedObject.saveAsComment(mock(Message.class)))
.doesNotThrowAnyException();
verify(commentService, times(0)).create(any(), any(), any(), any(), any(), any(), any());
verify(mailSender, times(1)).send(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.gepardec.mega.notification.mail.receiver;

import com.sun.mail.imap.IMAPMessage;
import io.quarkus.test.InjectMock;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
Expand Down Expand Up @@ -64,7 +63,7 @@ void setup() throws MessagingException, IOException {
var multipart = mock(Multipart.class);
when(multipart.getBodyPart(0)).thenReturn(bodyPart);

givenMessage = mock(IMAPMessage.class);
givenMessage = mock(Message.class);
when(givenMessage.getContent()).thenReturn(multipart);
when(givenMessage.getSubject()).thenReturn(SUBJECT);
}
Expand Down

0 comments on commit d8ea530

Please sign in to comment.