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 1396615
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ $RECYCLE.BIN/
*.lnk

# Secrets
.env
../../mega-backend-temp-shahin-vulnerability/.env

#IntelliJ
*.http
Expand Down
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
9 changes: 2 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
<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 +222,7 @@
<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(jakarta.mail.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,7 +12,6 @@
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;
Expand Down Expand Up @@ -74,7 +73,7 @@ void saveAsComment_BillableProject_Successful() throws MessagingException, IOExc
);

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

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

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

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

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

//WHEN
//THEN
assertThatCode(() -> testedObject.saveAsComment(mock(IMAPMessage.class)))
assertThatCode(() -> testedObject.saveAsComment(mock(jakarta.mail.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,6 @@
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 +64,7 @@ void setup() throws MessagingException, IOException {
var multipart = mock(Multipart.class);
when(multipart.getBodyPart(0)).thenReturn(bodyPart);

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

0 comments on commit 1396615

Please sign in to comment.