Skip to content

Commit be9d60e

Browse files
committed
test fixes
1 parent e429e20 commit be9d60e

2 files changed

Lines changed: 0 additions & 16 deletions

File tree

src/main/java/it/aboutbits/springboot/emailservice/lib/jpa/EmailRepository.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public interface EmailRepository extends JpaRepository<Email, Long> {
5151
)
5252
)
5353
order by e.scheduledAt
54-
limit :limit
5554
""")
5655
List<Long> findCandidateIdsToSend(
5756
@Param("now") OffsetDateTime now,

src/test/java/it/aboutbits/springboot/emailservice/lib/application/SendScheduledEmailsTest.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@
2828
import static org.mockito.Mockito.verify;
2929

3030
@SpringBootTest(properties = {
31-
"aboutbits.emailservice.scheduling.batch-size=5",
3231
"aboutbits.emailservice.scheduling.max-attempts=3",
3332
"aboutbits.emailservice.scheduling.stuck-sending-recovery-threshold=PT5M",
3433
"aboutbits.emailservice.scheduling.interval=30000"
3534
})
3635
@WithPostgres
3736
@NullMarked
3837
class SendScheduledEmailsTest {
39-
private static final int BATCH_SIZE = 5;
4038
private static final int MAX_ATTEMPTS = 3;
4139
private static final int SCHEDULER_INTERVAL_SECONDS = 30;
4240

@@ -69,19 +67,6 @@ void givenPendingEmails_sendEmails_shouldMarkAllAsSent() {
6967
verify(javaMailSender, times(3)).send(any(MimeMessage.class));
7068
}
7169

72-
@Test
73-
void givenMoreEmailsThanBatchSize_sendEmails_shouldProcessOnlyBatchSizePerPass() {
74-
var pending = 3 * BATCH_SIZE;
75-
emailRepository.saveAll(IntStream.range(0, pending).mapToObj(_ -> EmailFactory.once().build()).toList());
76-
77-
sendScheduledEmails.sendEmails();
78-
79-
assertThat(emailRepository.findAll())
80-
.filteredOn(email -> email.getState() == EmailState.SENT)
81-
.hasSize(BATCH_SIZE);
82-
verify(javaMailSender, times(BATCH_SIZE)).send(any(MimeMessage.class));
83-
}
84-
8570
@Test
8671
void givenRetryableFailure_sendEmails_shouldRescheduleWithBackoffAndIncrementAttempts() {
8772
doThrow(new MailSendException("smtp blip")).when(javaMailSender).send(any(MimeMessage.class));

0 commit comments

Comments
 (0)