Repository: Futsch1/medTimer (language: kotlin)

Issue:
Reminder: Every second day
I would need the reminder to be set only for every second day. 

Could this be included in a future release?:)

The best, Michael


Discussion hints:
Yes, I'll work on that in the coming weeks.

Pull request: Reminder every n days
closes #24 

Test command: ./gradlew :app:testDebugUnitTest --tests "com.futsch1.medtimer.ReminderSchedulerUnitTest"

Fix patch:
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 32be54582..c9a17187a 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -16,8 +16,8 @@ android {
         applicationId = "com.futsch1.medtimer"
         minSdk = 33
         targetSdk = 34
-        versionCode = 19
-        versionName = "1.2.2"
+        versionCode = 20
+        versionName = "1.3.0"
         setProperty("archivesBaseName", "MedTimer")
 
         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -43,35 +43,34 @@ android {
 }
 
 dependencies {
+    val roomVersion = "2.6.1"
+    val androidXNavigationVersion = "2.7.7"
+    val preferenceXVersion = "1.1.0"
+
     implementation("androidx.appcompat:appcompat:1.6.1")
     implementation("com.google.android.material:material:1.11.0")
     implementation("androidx.constraintlayout:constraintlayout:2.1.4")
-    implementation("androidx.navigation:navigation-fragment:2.7.7")
-    implementation("androidx.navigation:navigation-ui:2.7.7")
+    implementation("androidx.navigation:navigation-fragment:$androidXNavigationVersion")
+    implementation("androidx.navigation:navigation-ui:$androidXNavigationVersion")
     implementation("androidx.preference:preference:1.2.1")
     implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
     implementation("androidx.work:work-runtime:2.9.0")
     implementation("androidx.core:core-ktx:1.12.0")
     implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
-    testImplementation("junit:junit:4.13.2")
-    androidTestImplementation("androidx.test.ext:junit:1.1.5")
-    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
-
-    val roomVersion = "2.6.1"
-
     implementation("androidx.room:room-runtime:$roomVersion")
-    annotationProcessor("androidx.room:room-compiler:$roomVersion")
-
     implementation("org.mockito:mockito-core:5.11.0")
-    testImplementation("org.mockito:mockito-inline:5.2.0")
-
     implementation("com.github.skydoves:colorpickerview:2.3.0")
+    implementation("com.takisoft.preferencex:preferencex:$preferenceXVersion")
+    implementation("com.takisoft.preferencex:preferencex-ringtone:$preferenceXVersion")
+    implementation("com.github.wwdablu:SimplyPDF:2.1.1")
+
+    testImplementation("junit:junit:4.13.2")
+    testImplementation("org.mockito:mockito-inline:5.2.0")
 
-    implementation("com.takisoft.preferencex:preferencex:1.1.0")
-    implementation("com.takisoft.preferencex:preferencex-ringtone:1.1.0")
+    androidTestImplementation("androidx.test.ext:junit:1.1.5")
+    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
 
-    implementation("com.github.wwdablu:SimplyPDF:2.1.1")
-    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.0")
+    annotationProcessor("androidx.room:room-compiler:$roomVersion")
 }
 
 play {
diff --git a/app/src/main/java/com/futsch1/medtimer/database/MedicineRoomDatabase.java b/app/src/main/java/com/futsch1/medtimer/database/MedicineRoomDatabase.java
index e193e6d3c..01c3c84a2 100644
--- a/app/src/main/java/com/futsch1/medtimer/database/MedicineRoomDatabase.java
+++ b/app/src/main/java/com/futsch1/medtimer/database/MedicineRoomDatabase.java
@@ -14,30 +14,33 @@
 
 @Database(
         entities = {Medicine.class, Reminder.class, ReminderEvent.class},
-        version = 3,
+        version = 4,
         autoMigrations = {
                 @AutoMigration(from = 1, to = 2, spec = MedicineRoomDatabase.AutoMigration1To2.class),
-                @AutoMigration(from = 2, to = 3)
+                @AutoMigration(from = 2, to = 3),
+                @AutoMigration(from = 3, to = 4)
         }
 )
+@SuppressWarnings("java:S6548")
 public abstract class MedicineRoomDatabase extends RoomDatabase {
     private static final int NUMBER_OF_THREADS = 4;
     static final ExecutorService databaseWriteExecutor =
             Executors.newFixedThreadPool(NUMBER_OF_THREADS);
     // marking the instance as volatile to ensure atomic access to the variable
-    private static volatile MedicineRoomDatabase INSTANCE;
+    @SuppressWarnings("java:S3077")
+    private static volatile MedicineRoomDatabase instance;
 
     static MedicineRoomDatabase getDatabase(final Context context) {
-        if (INSTANCE == null) {
+        if (instance == null) {
             synchronized (MedicineRoomDatabase.class) {
-                if (INSTANCE == null) {
-                    INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
+                if (instance == null) {
+                    instance = Room.databaseBuilder(context.getApplicationContext(),
                                     MedicineRoomDatabase.class, "medTimer")
                             .build();
                 }
             }
         }
-        return INSTANCE;
+        return instance;
     }
 
     public abstract MedicineDao medicineDao();
diff --git a/app/src/main/java/com/futsch1/medtimer/database/Reminder.java b/app/src/main/java/com/futsch1/medtimer/database/Reminder.java
index 3781185e8..8660a1f56 100644
--- a/app/src/main/java/com/futsch1/medtimer/database/Reminder.java
+++ b/app/src/main/java/com/futsch1/medtimer/database/Reminder.java
@@ -5,6 +5,7 @@
 import androidx.room.PrimaryKey;
 
 @Entity
+@SuppressWarnings("java:S1104")
 public class Reminder {
     public final int medicineRelId;
     @PrimaryKey(autoGenerate = true)
@@ -12,12 +13,15 @@ public class Reminder {
     public int timeInMinutes;
     @ColumnInfo(defaultValue = "0")
     public long createdTimestamp;
+    @ColumnInfo(defaultValue = "1")
+    public int daysBetweenReminders;
 
     public String amount;
 
     public Reminder(int medicineRelId) {
         timeInMinutes = 480;
         amount = "?";
+        daysBetweenReminders = 1;
         this.medicineRelId = medicineRelId;
     }
 }
diff --git a/app/src/main/java/com/futsch1/medtimer/medicine/MedicineViewHolder.java b/app/src/main/java/com/futsch1/medtimer/medicine/MedicineViewHolder.java
index 3fc9c9fa6..40ec3e33b 100644
--- a/app/src/main/java/com/futsch1/medtimer/medicine/MedicineViewHolder.java
+++ b/app/src/main/java/com/futsch1/medtimer/medicine/MedicineViewHolder.java
@@ -29,13 +29,13 @@
 public class MedicineViewHolder extends RecyclerView.ViewHolder {
     private final TextView medicineNameView;
     private final TextView remindersSummaryView;
-    private final View itemView;
+    private final View holderItemView;
 
-    private MedicineViewHolder(View itemView) {
-        super(itemView);
-        this.itemView = itemView;
-        medicineNameView = itemView.findViewById(R.id.medicineName);
-        remindersSummaryView = itemView.findViewById(R.id.remindersSummary);
+    private MedicineViewHolder(View holderItemView) {
+        super(holderItemView);
+        this.holderItemView = holderItemView;
+        medicineNameView = holderItemView.findViewById(R.id.medicineName);
+        remindersSummaryView = holderItemView.findViewById(R.id.remindersSummary);
     }
 
     static MedicineViewHolder create(ViewGroup parent) {
@@ -52,20 +52,20 @@ public void bind(MedicineWithReminders medicineWithReminders, DeleteCallback del
             remindersSummaryView.setText(getRemindersSummary(medicineWithReminders));
         }
 
-        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this.itemView.getContext());
+        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this.holderItemView.getContext());
 
-        itemView.setOnLongClickListener(v -> {
+        holderItemView.setOnLongClickListener(v -> {
             if (sharedPref.getString("delete_items", "0").equals("0")) {
                 return false;
             }
-            PopupMenu popupMenu = new PopupMenu(itemView.getContext(), this.itemView);
+            PopupMenu popupMenu = new PopupMenu(holderItemView.getContext(), this.holderItemView);
             popupMenu.getMenuInflater().inflate(R.menu.edit_delete_popup, popupMenu.getMenu());
             popupMenu.getMenu().findItem(R.id.edit).setOnMenuItemClickListener(item -> {
                 startEditActivity(medicineWithReminders);
                 return true;
             });
             popupMenu.getMenu().findItem(R.id.delete).setOnMenuItemClickListener(item -> {
-                deleteCallback.deleteItem(itemView.getContext(), getItemId(), getAdapterPosition());
+                deleteCallback.deleteItem(holderItemView.getContext(), getItemId(), getAdapterPosition());
                 return true;
             });
             popupMenu.show();
@@ -73,33 +73,33 @@ public void bind(MedicineWithReminders medicineWithReminders, DeleteCallback del
         });
 
 
-        itemView.setOnClickListener(view -> startEditActivity(medicineWithReminders));
+        holderItemView.setOnClickListener(view -> startEditActivity(medicineWithReminders));
 
         if (medicineWithReminders.medicine.useColor) {
-            ViewColorHelper.setCardBackground((MaterialCardView) itemView, Arrays.asList(medicineNameView, remindersSummaryView), medicineWithReminders.medicine.color);
+            ViewColorHelper.setCardBackground((MaterialCardView) holderItemView, Arrays.asList(medicineNameView, remindersSummaryView), medicineWithReminders.medicine.color);
         } else {
-            ViewColorHelper.setDefaultColors((MaterialCardView) itemView, Arrays.asList(medicineNameView, remindersSummaryView));
+            ViewColorHelper.setDefaultColors((MaterialCardView) holderItemView, Arrays.asList(medicineNameView, remindersSummaryView));
         }
     }
 
     private String getRemindersSummary(MedicineWithReminders medicineWithReminders) {
         ArrayList<String> reminderTimes = new ArrayList<>();
-        int[] timesInMinutes = medicineWithReminders.reminders.stream().mapToInt((r) -> r.timeInMinutes).sorted().toArray();
+        int[] timesInMinutes = medicineWithReminders.reminders.stream().mapToInt(r -> r.timeInMinutes).sorted().toArray();
         for (int minute : timesInMinutes) {
             reminderTimes.add(TimeHelper.minutesToTime(minute));
         }
         int len = medicineWithReminders.reminders.size();
-        return remindersSummaryView.getResources().getQuantityString(R.plurals.reminders_per_day, len, len, String.join(", ", reminderTimes));
+        return remindersSummaryView.getResources().getQuantityString(R.plurals.sum_reminders, len, len, String.join(", ", reminderTimes));
 
     }
 
     private void startEditActivity(MedicineWithReminders medicineWithReminders) {
-        Intent intent = new Intent(itemView.getContext(), EditMedicine.class);
+        Intent intent = new Intent(holderItemView.getContext(), EditMedicine.class);
         intent.putExtra(EXTRA_ID, medicineWithReminders.medicine.medicineId);
         intent.putExtra(EXTRA_USE_COLOR, medicineWithReminders.medicine.useColor);
         intent.putExtra(EXTRA_COLOR, medicineWithReminders.medicine.color);
         intent.putExtra(EXTRA_MEDICINE_NAME, medicineWithReminders.medicine.name);
-        itemView.getContext().startActivity(intent);
+        holderItemView.getContext().startActivity(intent);
     }
 
     public interface DeleteCallback {
diff --git a/app/src/main/java/com/futsch1/medtimer/medicine/MedicinesFragment.java b/app/src/main/java/com/futsch1/medtimer/medicine/MedicinesFragment.java
index 107702d6b..d4d5e6a1e 100644
--- a/app/src/main/java/com/futsch1/medtimer/medicine/MedicinesFragment.java
+++ b/app/src/main/java/com/futsch1/medtimer/medicine/MedicinesFragment.java
@@ -1,5 +1,8 @@
 package com.futsch1.medtimer.medicine;
 
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+
 import android.app.AlertDialog;
 import android.content.Context;
 import android.content.SharedPreferences;
@@ -33,6 +36,7 @@
 
 public class MedicinesFragment extends Fragment {
     private HandlerThread thread;
+    @SuppressWarnings("java:S1450")
     private MedicineViewModel medicineViewModel;
     private MedicineViewAdapter adapter;
     private SwipeHelper swipeHelper;
@@ -112,23 +116,29 @@ private void setupAddMedicineButton(View fragmentView) {
         fab.setOnClickListener(view -> {
             TextInputLayout textInputLayout = new TextInputLayout(requireContext());
             TextInputEditText editText = new TextInputEditText(requireContext());
-            editText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
+            editText.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
             editText.setHint(R.string.medicine_name);
             editText.setSingleLine();
             textInputLayout.addView(editText);
 
-            AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
-            builder.setView(textInputLayout);
-            builder.setTitle(R.string.add_medicine);
-            builder.setPositiveButton(R.string.ok, (dialog, which) -> {
-                Editable e = editText.getText();
-                if (e != null) {
-                    medicineViewModel.insertMedicine(new Medicine(e.toString()));
-                }
-            });
-            builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
+            AlertDialog.Builder builder = getAlertBuilder(textInputLayout, editText);
             AlertDialog dialog = builder.create();
             dialog.show();
         });
     }
+
+    @NonNull
+    private AlertDialog.Builder getAlertBuilder(TextInputLayout textInputLayout, TextInputEditText editText) {
+        AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+        builder.setView(textInputLayout);
+        builder.setTitle(R.string.add_medicine);
+        builder.setPositiveButton(R.string.ok, (dialog, which) -> {
+            Editable e = editText.getText();
+            if (e != null) {
+                medicineViewModel.insertMedicine(new Medicine(e.toString()));
+            }
+        });
+        builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
+        return builder;
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/futsch1/medtimer/medicine/ReminderViewAdapter.java b/app/src/main/java/com/futsch1/medtimer/medicine/ReminderViewAdapter.java
index 77659f0ee..cc23827d7 100644
--- a/app/src/main/java/com/futsch1/medtimer/medicine/ReminderViewAdapter.java
+++ b/app/src/main/java/com/futsch1/medtimer/medicine/ReminderViewAdapter.java
@@ -49,7 +49,7 @@ public boolean areItemsTheSame(@NonNull Reminder oldItem, @NonNull Reminder newI
         @Override
         public boolean areContentsTheSame(@NonNull Reminder oldItem, @NonNull Reminder newItem) {
             return oldItem.reminderId == newItem.reminderId && oldItem.amount.equals(newItem.amount)
-                    && oldItem.timeInMinutes == newItem.timeInMinutes;
+                    && oldItem.timeInMinutes == newItem.timeInMinutes && oldItem.daysBetweenReminders == newItem.daysBetweenReminders;
         }
     }
 }
diff --git a/app/src/main/java/com/futsch1/medtimer/medicine/ReminderViewHolder.java b/app/src/main/java/com/futsch1/medtimer/medicine/ReminderViewHolder.java
index e6f1eee90..1a7fb931b 100644
--- a/app/src/main/java/com/futsch1/medtimer/medicine/ReminderViewHolder.java
+++ b/app/src/main/java/com/futsch1/medtimer/medicine/ReminderViewHolder.java
@@ -2,6 +2,7 @@
 
 import static com.futsch1.medtimer.helpers.TimeHelper.minutesToTime;
 
+import android.annotation.SuppressLint;
 import android.app.TimePickerDialog;
 import android.content.Context;
 import android.content.SharedPreferences;
@@ -21,7 +22,8 @@
 public class ReminderViewHolder extends RecyclerView.ViewHolder {
     private final EditText editTime;
     private final EditText editAmount;
-    private final View itemView;
+    private final EditText editDaysBetweenReminders;
+    private final View holderItemView;
 
     private Reminder reminder;
 
@@ -30,7 +32,8 @@ private ReminderViewHolder(View itemView) {
         super(itemView);
         editTime = itemView.findViewById(R.id.editReminderTime);
         editAmount = itemView.findViewById(R.id.editAmount);
-        this.itemView = itemView;
+        editDaysBetweenReminders = itemView.findViewById(R.id.daysBetweenReminders);
+        this.holderItemView = itemView;
     }
 
     static ReminderViewHolder create(ViewGroup parent) {
@@ -39,10 +42,12 @@ static ReminderViewHolder create(ViewGroup parent) {
         return new ReminderViewHolder(view);
     }
 
+    @SuppressLint("SetTextI18n")
     public void bind(Reminder reminder, DeleteCallback deleteCallback) {
         this.reminder = reminder;
 
         editTime.setText(minutesToTime(reminder.timeInMinutes));
+        editDaysBetweenReminders.setText(Integer.toString(reminder.daysBetweenReminders));
 
         TimePickerDialog timePickerDialog = new TimePickerDialog(editTime.getContext(), (view, hourOfDay, minute) -> {
             String selectedTime = minutesToTime(hourOfDay * 60L + minute);
@@ -56,14 +61,14 @@ public void bind(Reminder reminder, DeleteCallback deleteCallback) {
             }
         });
 
-        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this.itemView.getContext());
+        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this.holderItemView.getContext());
 
-        itemView.setOnLongClickListener(v -> {
+        holderItemView.setOnLongClickListener(v -> {
             if (sharedPref.getString("delete_items", "0").equals("0")) {
                 return false;
             }
 
-            PopupMenu popupMenu = new PopupMenu(editTime.getContext(), this.itemView);
+            PopupMenu popupMenu = new PopupMenu(editTime.getContext(), this.holderItemView);
             popupMenu.getMenuInflater().inflate(R.menu.edit_delete_popup, popupMenu.getMenu());
             popupMenu.getMenu().findItem(R.id.edit).setVisible(false);
             popupMenu.getMenu().findItem(R.id.delete).setOnMenuItemClickListener(item -> {
@@ -79,6 +84,14 @@ public void bind(Reminder reminder, DeleteCallback deleteCallback) {
 
     public Reminder getReminder() {
         reminder.amount = editAmount.getText().toString();
+        try {
+            reminder.daysBetweenReminders = Integer.parseInt(editDaysBetweenReminders.getText().toString());
+            if (reminder.daysBetweenReminders <= 0) {
+                reminder.daysBetweenReminders = 1;
+            }
+        } catch (NumberFormatException e) {
+            reminder.daysBetweenReminders = 1;
+        }
         return reminder;
     }
 
diff --git a/app/src/main/java/com/futsch1/medtimer/reminders/ReminderScheduler.java b/app/src/main/java/com/futsch1/medtimer/reminders/ReminderScheduler.java
index f9a1a216a..5ed9fc656 100644
--- a/app/src/main/java/com/futsch1/medtimer/reminders/ReminderScheduler.java
+++ b/app/src/main/java/com/futsch1/medtimer/reminders/ReminderScheduler.java
@@ -34,16 +34,15 @@ public ReminderScheduler(ScheduleListener listener, TimeAccess timeAccess) {
     public void schedule(@NonNull List<MedicineWithReminders> medicineWithReminders, List<ReminderEvent> reminderEvents) {
         ArrayList<Reminder> sortedReminders = getSortedReminders(medicineWithReminders);
 
-        if (sortedReminders.size() > 0) {
+        if (!sortedReminders.isEmpty()) {
             LocalDate checkDate = this.timeAccess.localDate();
-            Reminder nextReminder = findNextReminder(sortedReminders, reminderEvents, checkDate);
+            Reminder nextReminder = null;
 
-            if (nextReminder == null) {
-                checkDate = checkDate.plusDays(1);
-                nextReminder = sortedReminders.get(0);
-                Log.d(LogTags.SCHEDULER,
-                        String.format("Scheduling reminder ID %d to the next day",
-                                nextReminder.reminderId));
+            while (nextReminder == null) {
+                nextReminder = findNextReminder(sortedReminders, reminderEvents, checkDate);
+                if (nextReminder == null) {
+                    checkDate = checkDate.plusDays(1);
+                }
             }
 
             Instant targetInstant = getTargetInstant(nextReminder, checkDate);
@@ -73,8 +72,10 @@ private ArrayList<Reminder> getSortedReminders(List<MedicineWithReminders> medic
 
             boolean justCreated = targetInstant.isBefore(Instant.ofEpochSecond(reminder.createdTimestamp));
             boolean isTimeForReminder = !targetInstant.isBefore(lastReminder);
+            boolean isDueToday = isDueToday(reminder, reminderEvents, checkDate);
+            boolean wasProcessed = wasProcessed(reminder, reminderEvents, targetInstant);
 
-            if (!justCreated && isTimeForReminder && !wasProcessed(reminder, reminderEvents, targetInstant)) {
+            if (!justCreated && isTimeForReminder && !wasProcessed && isDueToday) {
                 Log.d(LogTags.SCHEDULER,
                         String.format("Scheduling reminder ID%d to %s, last was %s with ID %d",
                                 reminder.reminderId,
@@ -107,13 +108,27 @@ private Medicine getMedicine(Reminder reminder, List<MedicineWithReminders> medi
     }
 
     private @Nullable ReminderEvent getLastReminderEvent(List<ReminderEvent> reminderEvents) {
-        return reminderEvents.size() > 0 ? reminderEvents.get(reminderEvents.size() - 1) : null;
+        return !reminderEvents.isEmpty() ? reminderEvents.get(reminderEvents.size() - 1) : null;
     }
 
     private Instant getReminderEventInstant(@Nullable ReminderEvent reminderEvent) {
         return reminderEvent != null ? Instant.ofEpochSecond(reminderEvent.remindedTimestamp) : Instant.EPOCH;
     }
 
+    private boolean isDueToday(Reminder reminder, List<ReminderEvent> reminderEvents, LocalDate checkDate) {
+        boolean dueToday = true;
+        if (reminder.daysBetweenReminders > 1) {
+            // Search for reminder n days in the past
+            for (ReminderEvent event : reminderEvents) {
+                dueToday = isReminderDueToday(reminder, checkDate, event);
+                if (!dueToday) {
+                    break;
+                }
+            }
+        }
+        return dueToday;
+    }
+
     private boolean wasProcessed(Reminder reminder, List<ReminderEvent> reminderEvents, Instant targetInstant) {
         for (ReminderEvent reminderEvent : reminderEvents) {
             if (reminderEvent.reminderId == reminder.reminderId && !Instant.ofEpochSecond(reminderEvent.remindedTimestamp).isBefore(targetInstant)) {
@@ -123,6 +138,17 @@ private boolean wasProcessed(Reminder reminder, List<ReminderEvent> reminderEven
         return false;
     }
 
+    private boolean isReminderDueToday(Reminder reminder, LocalDate checkDate, ReminderEvent event) {
+        boolean dueToday = true;
+        if (event.reminderId == reminder.reminderId) {
+            OffsetDateTime eventDate = OffsetDateTime.ofInstant(Instant.ofEpochSecond(event.remindedTimestamp), timeAccess.systemZone());
+            if (eventDate.toLocalDate().plusDays(reminder.daysBetweenReminders).isAfter(checkDate)) {
+                dueToday = false;
+            }
+        }
+        return dueToday;
+    }
+
     public interface ScheduleListener {
         void schedule(Instant timestamp, Medicine medicine, Reminder reminder);
     }
diff --git a/app/src/main/res/layout/fragment_reminder.xml b/app/src/main/res/layout/fragment_reminder.xml
index ec3a67055..d18d4ef5e 100644
--- a/app/src/main/res/layout/fragment_reminder.xml
+++ b/app/src/main/res/layout/fragment_reminder.xml
@@ -45,6 +45,34 @@
             android:inputType="text"
             android:text="@string/dosage" />
 
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="horizontal">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/remind_every" />
+
+            <EditText
+                android:id="@+id/daysBetweenReminders"
+                android:layout_width="60dp"
+                android:layout_height="48dp"
+                android:layout_marginStart="3dp"
+                android:layout_marginEnd="3dp"
+                android:ems="10"
+                android:hint="@string/days"
+                android:importantForAutofill="no"
+                android:inputType="numberSigned"
+                android:text="@string/days" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/days" />
+        </LinearLayout>
+
     </LinearLayout>
 
 </com.google.android.material.card.MaterialCardView>
\ No newline at end of file
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 439ba8e51..6e50d8ae4 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -25,7 +25,7 @@
     <string name="reminder_event">%1$s von %2$s\n%3$s</string>
     <string name="recent_reminders">Kürzliche Erinnerungen</string>
     <string name="next_reminder">Nächste Erinnerung</string>
-    <plurals name="reminders_per_day">
+    <plurals name="sum_reminders">
         <item quantity="one">%1$d Erinnerung pro Tag\n%2$s</item>
         <item quantity="other">%1$d Erinnerungen pro Tag\n%2$s</item>
     </plurals>
@@ -59,4 +59,6 @@
     <string name="create_reminder_dosage_hint">Dosierung für neue Erinnerung</string>
     <string name="notification_tone_title">Benachrichtigungston</string>
     <string name="select_format">Format auswählen</string>
+    <string name="remind_every">Erinnere alle</string>
+    <string name="days">Tage</string>
 </resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5ddec2793..55110a14a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -16,9 +16,9 @@
     <string name="confirm">Confirm</string>
     <string name="are_you_sure_delete_medicine">Are you sure to delete the medicine?</string>
     <string name="no_reminders">No reminders set</string>
-    <plurals name="reminders_per_day">
-        <item quantity="one">%1$d reminder per day\n%2$s</item>
-        <item quantity="other">%1$d reminders per day\n%2$s</item>
+    <plurals name="sum_reminders">
+        <item quantity="one">%1$d reminder\n%2$s</item>
+        <item quantity="other">%1$d reminders\n%2$s</item>
     </plurals>
     <string name="channel_name" translatable="false">MedTimer</string>
     <string name="channel_description" translatable="false">Notifications from MedTimer</string>
@@ -60,4 +60,6 @@
     <string name="create_reminder_dosage_hint">Dosage for new reminder</string>
     <string name="notification_tone_title">Notification tone</string>
     <string name="select_format">Select format</string>
+    <string name="remind_every">Remind every</string>
+    <string name="days">days</string>
 </resources>
\ No newline at end of file


Test patch:
diff --git a/app/src/main/java/com/futsch1/medtimer/GenerateTestData.java b/app/src/main/java/com/futsch1/medtimer/GenerateTestData.java
index 05ba5449b..e4160c67e 100644
--- a/app/src/main/java/com/futsch1/medtimer/GenerateTestData.java
+++ b/app/src/main/java/com/futsch1/medtimer/GenerateTestData.java
@@ -19,18 +19,18 @@ public void deleteAll() {
     public void generateTestMedicine() {
         TestMedicine[] testMedicines = new TestMedicine[]{
                 new TestMedicine("Omega 3 (EPA/DHA 500mg)", null, new TestReminder[]{
-                        new TestReminder("1", 9 * 60),
-                        new TestReminder("1", 18 * 60)
+                        new TestReminder("1", 9 * 60, 1),
+                        new TestReminder("1", 18 * 60, 2)
                 }),
                 new TestMedicine("B12 (500µg)", 0xFF8b0000, new TestReminder[]{
-                        new TestReminder("2", 7 * 60)
+                        new TestReminder("2", 7 * 60, 1)
                 }),
                 new TestMedicine("Ginseng (200mg)", 0xFF90EE90, new TestReminder[]{
-                        new TestReminder("1", 9 * 60)
+                        new TestReminder("1", 9 * 60, 1)
                 }),
                 new TestMedicine("Selen (200 µg)", null, new TestReminder[]{
-                        new TestReminder("2", 9 * 60),
-                        new TestReminder("1", 18 * 60)
+                        new TestReminder("2", 9 * 60, 1),
+                        new TestReminder("1", 18 * 60, 1)
                 })
         };
 
@@ -45,6 +45,7 @@ public void generateTestMedicine() {
                 Reminder reminder = new Reminder(medicineId);
                 reminder.amount = testReminder.amount;
                 reminder.timeInMinutes = testReminder.time;
+                reminder.daysBetweenReminders = testReminder.daysBetweenReminders;
                 viewModel.insertReminder(reminder);
             }
         }
@@ -63,12 +64,14 @@ public TestMedicine(String name, @Nullable Integer color, TestReminder[] reminde
     }
 
     private static class TestReminder {
+        int daysBetweenReminders;
         String amount;
         int time;
 
-        public TestReminder(String amount, int time) {
+        public TestReminder(String amount, int time, int daysBetweenReminders) {
             this.amount = amount;
             this.time = time;
+            this.daysBetweenReminders = daysBetweenReminders;
         }
     }
 }
diff --git a/app/src/test/java/com/futsch1/medtimer/ReminderSchedulerUnitTest.java b/app/src/test/java/com/futsch1/medtimer/ReminderSchedulerUnitTest.java
index 0f6eba44b..71fefc02f 100644
--- a/app/src/test/java/com/futsch1/medtimer/ReminderSchedulerUnitTest.java
+++ b/app/src/test/java/com/futsch1/medtimer/ReminderSchedulerUnitTest.java
@@ -1,9 +1,8 @@
 package com.futsch1.medtimer;
 
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.clearInvocations;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoInteractions;
@@ -40,7 +39,7 @@ public void scheduler_emptyLists() {
 
         // One medicine without reminders, no reminder events
         MedicineWithReminders medicineWithReminders = buildMedicineWithReminders(1, "Test");
-        scheduler.schedule(new ArrayList<MedicineWithReminders>() {{
+        scheduler.schedule(new ArrayList<>() {{
             add(medicineWithReminders);
         }}, new ArrayList<>());
         verifyNoInteractions(mock);
@@ -49,7 +48,7 @@ public void scheduler_emptyLists() {
         Reminder reminder = new Reminder(1);
         reminder.timeInMinutes = 12;
         medicineWithReminders.reminders.add(reminder);
-        scheduler.schedule(new ArrayList<MedicineWithReminders>() {{
+        scheduler.schedule(new ArrayList<>() {{
             add(medicineWithReminders);
         }}, new ArrayList<>());
         verify(mock, times(1)).schedule(Instant.ofEpochSecond(12 * 60), medicineWithReminders.medicine, reminder);
@@ -74,11 +73,11 @@ public void scheduler_reminders() {
         ReminderScheduler scheduler = new ReminderScheduler(mock, mockTimeAccess);
 
         MedicineWithReminders medicineWithReminders1 = buildMedicineWithReminders(1, "Test1");
-        Reminder reminder1 = buildReminder(1, 1, "1", 16);
-        Reminder reminder2 = buildReminder(1, 1, "2", 12);
+        Reminder reminder1 = buildReminder(1, 1, "1", 16, 1);
+        Reminder reminder2 = buildReminder(1, 1, "2", 12, 1);
         medicineWithReminders1.reminders.add(reminder1);
         medicineWithReminders1.reminders.add(reminder2);
-        scheduler.schedule(new ArrayList<MedicineWithReminders>() {{
+        scheduler.schedule(new ArrayList<>() {{
             add(medicineWithReminders1);
         }}, new ArrayList<>());
         verify(mock, times(1)).schedule(Instant.ofEpochSecond(12 * 60), medicineWithReminders1.medicine, reminder2);
@@ -86,20 +85,21 @@ public void scheduler_reminders() {
 
         // Now add a second medicine with an earlier reminder
         MedicineWithReminders medicineWithReminders2 = buildMedicineWithReminders(2, "Test2");
-        Reminder reminder3 = buildReminder(2, 1, "1", 3);
+        Reminder reminder3 = buildReminder(2, 1, "1", 3, 1);
         medicineWithReminders2.reminders.add(reminder3);
-        scheduler.schedule(new ArrayList<MedicineWithReminders>() {{
+        scheduler.schedule(new ArrayList<>() {{
             add(medicineWithReminders1);
             add(medicineWithReminders2);
         }}, new ArrayList<>());
         verify(mock, times(1)).schedule(Instant.ofEpochSecond(3 * 60), medicineWithReminders2.medicine, reminder3);
     }
 
-    private Reminder buildReminder(int medicineId, int reminderId, String amount, int timeInMinutes) {
+    private Reminder buildReminder(int medicineId, int reminderId, String amount, int timeInMinutes, int daysBetweenReminders) {
         Reminder reminder = new Reminder(medicineId);
         reminder.reminderId = reminderId;
         reminder.amount = amount;
         reminder.timeInMinutes = timeInMinutes;
+        reminder.daysBetweenReminders = daysBetweenReminders;
         return reminder;
     }
 
@@ -113,57 +113,57 @@ public void scheduler_withEvents() {
         ReminderScheduler scheduler = new ReminderScheduler(mock, mockTimeAccess);
 
         MedicineWithReminders medicineWithReminders1 = buildMedicineWithReminders(1, "Test1");
-        Reminder reminder1 = buildReminder(1, 1, "1", 16);
-        Reminder reminder2 = buildReminder(1, 2, "2", 12);
+        Reminder reminder1 = buildReminder(1, 1, "1", 16, 1);
+        Reminder reminder2 = buildReminder(1, 2, "2", 12, 1);
         medicineWithReminders1.reminders.add(reminder1);
         medicineWithReminders1.reminders.add(reminder2);
         MedicineWithReminders medicineWithReminders2 = buildMedicineWithReminders(2, "Test2");
-        Reminder reminder3 = buildReminder(2, 3, "1", 3);
+        Reminder reminder3 = buildReminder(2, 3, "1", 3, 1);
         medicineWithReminders2.reminders.add(reminder3);
-        ArrayList<MedicineWithReminders> medicineWithReminders = new ArrayList<MedicineWithReminders>() {{
+        ArrayList<MedicineWithReminders> medicineWithReminders = new ArrayList<>() {{
             add(medicineWithReminders1);
             add(medicineWithReminders2);
         }};
         // Reminder 3 already invoked
-        scheduler.schedule(medicineWithReminders, new ArrayList<ReminderEvent>() {{
+        scheduler.schedule(medicineWithReminders, new ArrayList<>() {{
             add(buildReminderEvent(3, 4 * 60));
         }});
-        verify(mock, times(1)).schedule(Instant.ofEpochSecond(12 * 60), medicineWithReminders1.medicine, reminder2);
+        verify(mock, times(1)).schedule(on(1, 12), medicineWithReminders1.medicine, reminder2);
         clearInvocations(mock);
 
         // Check two reminders at the same time
-        Reminder reminder4 = buildReminder(2, 4, "1", 12);
+        Reminder reminder4 = buildReminder(2, 4, "1", 12, 1);
         medicineWithReminders2.reminders.add(reminder4);
-        scheduler.schedule(medicineWithReminders, new ArrayList<ReminderEvent>() {{
+        scheduler.schedule(medicineWithReminders, new ArrayList<>() {{
             add(buildReminderEvent(2, 12 * 60));
         }});
-        verify(mock, times(1)).schedule(Instant.ofEpochSecond(12 * 60), medicineWithReminders2.medicine, reminder4);
+        verify(mock, times(1)).schedule(on(1, 12), medicineWithReminders2.medicine, reminder4);
         clearInvocations(mock);
 
-        scheduler.schedule(medicineWithReminders, new ArrayList<ReminderEvent>() {{
+        scheduler.schedule(medicineWithReminders, new ArrayList<>() {{
             add(buildReminderEvent(2, 12 * 60));
             add(buildReminderEvent(4, 12 * 60));
         }});
-        verify(mock, times(1)).schedule(Instant.ofEpochSecond(16 * 60), medicineWithReminders1.medicine, reminder1);
+        verify(mock, times(1)).schedule(on(1, 16), medicineWithReminders1.medicine, reminder1);
         clearInvocations(mock);
 
         // All reminders already invoked, switch to next day
-        scheduler.schedule(medicineWithReminders, new ArrayList<ReminderEvent>() {{
+        scheduler.schedule(medicineWithReminders, new ArrayList<>() {{
             add(buildReminderEvent(3, 4 * 60));
             add(buildReminderEvent(2, 12 * 60));
             add(buildReminderEvent(1, 16 * 60));
         }});
-        verify(mock, times(1)).schedule(Instant.ofEpochSecond((3 + 1440) * 60), medicineWithReminders2.medicine, reminder3);
+        verify(mock, times(1)).schedule(on(2, 3), medicineWithReminders2.medicine, reminder3);
         clearInvocations(mock);
 
         // All reminders already invoked, we are on the next day
         when(mockTimeAccess.localDate()).thenReturn(LocalDate.EPOCH.plusDays(1));
-        scheduler.schedule(medicineWithReminders, new ArrayList<ReminderEvent>() {{
+        scheduler.schedule(medicineWithReminders, new ArrayList<>() {{
             add(buildReminderEvent(3, 4 * 60));
             add(buildReminderEvent(2, 12 * 60));
             add(buildReminderEvent(1, 16 * 60));
         }});
-        verify(mock, times(1)).schedule(Instant.ofEpochSecond((3 + 1440) * 60), medicineWithReminders2.medicine, reminder3);
+        verify(mock, times(1)).schedule(on(2, 3), medicineWithReminders2.medicine, reminder3);
         clearInvocations(mock);
     }
 
@@ -174,9 +174,13 @@ private ReminderEvent buildReminderEvent(int reminderId, long raisedTimestamp) {
         return reminderEvent;
     }
 
-    // schedules a reminder for the next occurrence
+    private Instant on(long day, long minutes) {
+        return Instant.ofEpochSecond((day - 1) * 86400 + minutes * 60);
+    }
+
+    // schedules a reminder for the same day
     @Test
-    public void test_scheduleNextOccurrenceReminder() {
+    public void test_scheduleSameDayReminder() {
         ReminderScheduler.ScheduleListener mock = mock(ReminderScheduler.ScheduleListener.class);
         ReminderScheduler.TimeAccess mockTimeAccess = mock(ReminderScheduler.TimeAccess.class);
         when(mockTimeAccess.systemZone()).thenReturn(ZoneId.of("Z"));
@@ -185,7 +189,7 @@ public void test_scheduleNextOccurrenceReminder() {
         ReminderScheduler scheduler = new ReminderScheduler(mock, mockTimeAccess);
 
         MedicineWithReminders medicineWithReminders = buildMedicineWithReminders(1, "Test");
-        Reminder reminder = buildReminder(1, 1, "1", 16);
+        Reminder reminder = buildReminder(1, 1, "1", 480, 1);
         medicineWithReminders.reminders.add(reminder);
 
         List<MedicineWithReminders> medicineList = new ArrayList<>();
@@ -195,12 +199,41 @@ public void test_scheduleNextOccurrenceReminder() {
 
         scheduler.schedule(medicineList, reminderEventList);
 
-        verify(mock, times(1)).schedule(any(Instant.class), eq(medicineWithReminders.medicine), eq(reminder));
+        verify(mock, times(1)).schedule(on(1, 480), medicineWithReminders.medicine, reminder);
     }
 
-    // schedules a reminder for the same day
+    // schedules a reminder for a different medicine
     @Test
-    public void test_scheduleSameDayReminder() {
+    public void test_scheduleDifferentMedicineReminder() {
+        ReminderScheduler.ScheduleListener mock = mock(ReminderScheduler.ScheduleListener.class);
+        ReminderScheduler.TimeAccess mockTimeAccess = mock(ReminderScheduler.TimeAccess.class);
+        when(mockTimeAccess.systemZone()).thenReturn(ZoneId.of("Z"));
+        when(mockTimeAccess.localDate()).thenReturn(LocalDate.EPOCH);
+
+        ReminderScheduler scheduler = new ReminderScheduler(mock, mockTimeAccess);
+
+        MedicineWithReminders medicineWithReminders1 = buildMedicineWithReminders(1, "Test1");
+        Reminder reminder1 = buildReminder(1, 1, "1", 480, 1);
+        medicineWithReminders1.reminders.add(reminder1);
+
+        MedicineWithReminders medicineWithReminders2 = buildMedicineWithReminders(2, "Test2");
+        Reminder reminder2 = buildReminder(2, 2, "2", 480, 1);
+        medicineWithReminders2.reminders.add(reminder2);
+
+        List<MedicineWithReminders> medicineList = new ArrayList<>();
+        medicineList.add(medicineWithReminders1);
+        medicineList.add(medicineWithReminders2);
+
+        List<ReminderEvent> reminderEventList = new ArrayList<>();
+
+        scheduler.schedule(medicineList, reminderEventList);
+
+        verify(mock, times(1)).schedule(on(1, 480), medicineWithReminders1.medicine, reminder1);
+    }
+
+    // schedules a reminder for every two days
+    @Test
+    public void test_scheduleTwoDayReminder() {
         ReminderScheduler.ScheduleListener mock = mock(ReminderScheduler.ScheduleListener.class);
         ReminderScheduler.TimeAccess mockTimeAccess = mock(ReminderScheduler.TimeAccess.class);
         when(mockTimeAccess.systemZone()).thenReturn(ZoneId.of("Z"));
@@ -209,7 +242,7 @@ public void test_scheduleSameDayReminder() {
         ReminderScheduler scheduler = new ReminderScheduler(mock, mockTimeAccess);
 
         MedicineWithReminders medicineWithReminders = buildMedicineWithReminders(1, "Test");
-        Reminder reminder = buildReminder(1, 1, "1", 480);
+        Reminder reminder = buildReminder(1, 1, "1", 480, 2);
         medicineWithReminders.reminders.add(reminder);
 
         List<MedicineWithReminders> medicineList = new ArrayList<>();
@@ -219,12 +252,18 @@ public void test_scheduleSameDayReminder() {
 
         scheduler.schedule(medicineList, reminderEventList);
 
-        verify(mock, times(1)).schedule(any(Instant.class), eq(medicineWithReminders.medicine), eq(reminder));
+        verify(mock, times(1)).schedule(on(1, 480), medicineWithReminders.medicine, reminder);
+
+        reminderEventList.add(buildReminderEvent(1, on(1, 480).getEpochSecond()));
+        when(mockTimeAccess.localDate()).thenReturn(LocalDate.EPOCH.plusDays(1));
+
+        scheduler.schedule(medicineList, reminderEventList);
+        verify(mock, times(1)).schedule(on(3, 480), medicineWithReminders.medicine, reminder);
     }
 
-    // schedules a reminder for the next day
+    // schedules a reminder for every two days
     @Test
-    public void test_scheduleNextDayReminder() {
+    public void test_scheduleTwoDayReminderVsOneDay() {
         ReminderScheduler.ScheduleListener mock = mock(ReminderScheduler.ScheduleListener.class);
         ReminderScheduler.TimeAccess mockTimeAccess = mock(ReminderScheduler.TimeAccess.class);
         when(mockTimeAccess.systemZone()).thenReturn(ZoneId.of("Z"));
@@ -233,22 +272,25 @@ public void test_scheduleNextDayReminder() {
         ReminderScheduler scheduler = new ReminderScheduler(mock, mockTimeAccess);
 
         MedicineWithReminders medicineWithReminders = buildMedicineWithReminders(1, "Test");
-        Reminder reminder = buildReminder(1, 1, "1", 1440);
+        Reminder reminder = buildReminder(1, 1, "1", 480, 2);
         medicineWithReminders.reminders.add(reminder);
+        Reminder reminder2 = buildReminder(1, 2, "2", 481, 1);
+        medicineWithReminders.reminders.add(reminder2);
 
         List<MedicineWithReminders> medicineList = new ArrayList<>();
         medicineList.add(medicineWithReminders);
 
         List<ReminderEvent> reminderEventList = new ArrayList<>();
+        reminderEventList.add(buildReminderEvent(1, on(1, 480).getEpochSecond()));
 
-        scheduler.schedule(medicineList, reminderEventList);
+        when(mockTimeAccess.localDate()).thenReturn(LocalDate.EPOCH.plusDays(1));
 
-        verify(mock, times(1)).schedule(any(Instant.class), eq(medicineWithReminders.medicine), eq(reminder));
+        scheduler.schedule(medicineList, reminderEventList);
+        verify(mock, times(1)).schedule(on(2, 481), medicineWithReminders.medicine, reminder2);
     }
 
-    // schedules a reminder for a different medicine
     @Test
-    public void test_scheduleDifferentMedicineReminder() {
+    public void test_scheduleTwoDayReminderVsFourDays() {
         ReminderScheduler.ScheduleListener mock = mock(ReminderScheduler.ScheduleListener.class);
         ReminderScheduler.TimeAccess mockTimeAccess = mock(ReminderScheduler.TimeAccess.class);
         when(mockTimeAccess.systemZone()).thenReturn(ZoneId.of("Z"));
@@ -256,22 +298,42 @@ public void test_scheduleDifferentMedicineReminder() {
 
         ReminderScheduler scheduler = new ReminderScheduler(mock, mockTimeAccess);
 
-        MedicineWithReminders medicineWithReminders1 = buildMedicineWithReminders(1, "Test1");
-        Reminder reminder1 = buildReminder(1, 1, "1", 480);
-        medicineWithReminders1.reminders.add(reminder1);
-
-        MedicineWithReminders medicineWithReminders2 = buildMedicineWithReminders(2, "Test2");
-        Reminder reminder2 = buildReminder(2, 2, "2", 480);
-        medicineWithReminders2.reminders.add(reminder2);
+        MedicineWithReminders medicineWithReminders = buildMedicineWithReminders(1, "Test");
+        Reminder reminder = buildReminder(1, 1, "1", 480, 2);
+        medicineWithReminders.reminders.add(reminder);
+        Reminder reminder2 = buildReminder(1, 2, "2", 481, 4);
+        medicineWithReminders.reminders.add(reminder2);
 
         List<MedicineWithReminders> medicineList = new ArrayList<>();
-        medicineList.add(medicineWithReminders1);
-        medicineList.add(medicineWithReminders2);
+        medicineList.add(medicineWithReminders);
 
         List<ReminderEvent> reminderEventList = new ArrayList<>();
+        reminderEventList.add(buildReminderEvent(1, 480 * 60));
+
+        when(mockTimeAccess.localDate()).thenReturn(LocalDate.EPOCH.plusDays(1));
+
+        scheduler.schedule(medicineList, reminderEventList);
+        verify(mock, times(1)).schedule(on(2, 481), medicineWithReminders.medicine, reminder2);
+
+        reminderEventList.add(buildReminderEvent(2, on(2, 481).getEpochSecond()));
+
+        scheduler.schedule(medicineList, reminderEventList);
+        verify(mock, times(1)).schedule(on(3, 480), medicineWithReminders.medicine, reminder);
+
+        when(mockTimeAccess.localDate()).thenReturn(LocalDate.EPOCH.plusDays(1));
+
+        reset(mock);
+        scheduler.schedule(medicineList, reminderEventList);
+        verify(mock, times(1)).schedule(on(3, 480), medicineWithReminders.medicine, reminder);
+
+        reminderEventList.add(buildReminderEvent(1, on(3, 480).getEpochSecond()));
 
         scheduler.schedule(medicineList, reminderEventList);
+        verify(mock, times(1)).schedule(on(5, 480), medicineWithReminders.medicine, reminder);
 
-        verify(mock, times(1)).schedule(any(Instant.class), eq(medicineWithReminders1.medicine), eq(reminder1));
+        reminderEventList.add(buildReminderEvent(1, on(5, 480).getEpochSecond()));
+
+        scheduler.schedule(medicineList, reminderEventList);
+        verify(mock, times(1)).schedule(on(6, 481), medicineWithReminders.medicine, reminder2);
     }
 }
\ No newline at end of file