Skip to content
Permalink
Browse files
JSIEVE-111 Upgrade mockito-core 1.9.0 -> 3.0.0
  • Loading branch information
Arsnael committed Sep 10, 2019
1 parent 769827e commit a34a7313d856aad11841d99fad3c0cad3f562cf2
Showing 2 changed files with 31 additions and 23 deletions.
@@ -19,6 +19,12 @@

package org.apache.jsieve;

import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

import org.apache.jsieve.exception.SyntaxException;
import org.apache.jsieve.mail.ActionKeep;
import org.apache.jsieve.mail.optional.ActionVacation;
@@ -27,12 +33,6 @@
import org.junit.Before;
import org.junit.Test;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

public class VacationTest {

private SieveMailAdapter sieveMailAdapter;
@@ -111,9 +111,10 @@ public void vacationShouldWork() throws Exception {

JUnitUtils.interpret(sieveMailAdapter, script);

verify(sieveMailAdapter, times(2)).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(isNull(SieveContext.class));
verify(sieveMailAdapter).addAction(ActionVacation.builder().reason("reason").build());
verify(sieveMailAdapter, times(2)).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).executeActions();
verifyNoMoreInteractions(sieveMailAdapter);
}
@@ -124,9 +125,10 @@ public void daysShouldWork() throws Exception {

JUnitUtils.interpret(sieveMailAdapter, script);

verify(sieveMailAdapter, times(2)).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(isNull(SieveContext.class));
verify(sieveMailAdapter).addAction(ActionVacation.builder().reason("reason").duration(3).build());
verify(sieveMailAdapter, times(2)).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).executeActions();
verifyNoMoreInteractions(sieveMailAdapter);
}
@@ -137,9 +139,10 @@ public void subjectShouldWork() throws Exception {

JUnitUtils.interpret(sieveMailAdapter, script);

verify(sieveMailAdapter, times(2)).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(isNull(SieveContext.class));
verify(sieveMailAdapter).addAction(ActionVacation.builder().reason("reason").subject("any").build());
verify(sieveMailAdapter, times(2)).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).executeActions();
verifyNoMoreInteractions(sieveMailAdapter);
}
@@ -150,9 +153,10 @@ public void fromShouldWork() throws Exception {

JUnitUtils.interpret(sieveMailAdapter, script);

verify(sieveMailAdapter, times(2)).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(isNull(SieveContext.class));
verify(sieveMailAdapter).addAction(ActionVacation.builder().reason("reason").from("benwa@apache.org").build());
verify(sieveMailAdapter, times(2)).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).executeActions();
verifyNoMoreInteractions(sieveMailAdapter);
}
@@ -164,9 +168,10 @@ public void addressesShouldWork() throws Exception {

JUnitUtils.interpret(sieveMailAdapter, script);

verify(sieveMailAdapter, times(2)).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(isNull(SieveContext.class));
verify(sieveMailAdapter).addAction(ActionVacation.builder().reason("reason").build());
verify(sieveMailAdapter, times(2)).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).executeActions();
verifyNoMoreInteractions(sieveMailAdapter);
}
@@ -177,9 +182,10 @@ public void mimeShouldWork() throws Exception {

JUnitUtils.interpret(sieveMailAdapter, script);

verify(sieveMailAdapter, times(2)).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(isNull(SieveContext.class));
verify(sieveMailAdapter).addAction(ActionVacation.builder().mime("reason").build());
verify(sieveMailAdapter, times(2)).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).executeActions();
verifyNoMoreInteractions(sieveMailAdapter);
}
@@ -190,9 +196,10 @@ public void handleShouldWork() throws Exception {

JUnitUtils.interpret(sieveMailAdapter, script);

verify(sieveMailAdapter, times(2)).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(isNull(SieveContext.class));
verify(sieveMailAdapter).addAction(ActionVacation.builder().reason("reason").handle("plop").build());
verify(sieveMailAdapter, times(2)).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).executeActions();
verifyNoMoreInteractions(sieveMailAdapter);
}
@@ -225,9 +232,10 @@ public void reasonAsStringListWithOneEntryShouldWork() throws Exception {

JUnitUtils.interpret(sieveMailAdapter, script);

verify(sieveMailAdapter, times(2)).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(any(SieveContext.class));
verify(sieveMailAdapter).setContext(isNull(SieveContext.class));
verify(sieveMailAdapter).addAction(ActionVacation.builder().reason("reason").build());
verify(sieveMailAdapter, times(2)).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).addAction(any(ActionKeep.class));
verify(sieveMailAdapter).executeActions();
verifyNoMoreInteractions(sieveMailAdapter);
}
@@ -82,7 +82,7 @@
<mail.version>1.4.7</mail.version>
<activation.version>1.1.1</activation.version>
<commons-io.version>2.1</commons-io.version>
<mockito-core.version>1.9.0</mockito-core.version>
<mockito-core.version>3.0.0</mockito-core.version>
<assertj.version>1.7.1</assertj.version>
<guava.version>18.0</guava.version>
<mime4j.version>0.8.3</mime4j.version>

0 comments on commit a34a731

Please sign in to comment.