From b6592e605c85a1a5f2eb6b216587400a7e864dfb Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Tue, 5 Sep 2023 17:16:42 -0300 Subject: [PATCH] More treatment manager tests; --- .../TreatmentManagerWithFlagSetsTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/test/java/io/split/android/client/TreatmentManagerWithFlagSetsTest.java b/src/test/java/io/split/android/client/TreatmentManagerWithFlagSetsTest.java index 90539b17b..42281896f 100644 --- a/src/test/java/io/split/android/client/TreatmentManagerWithFlagSetsTest.java +++ b/src/test/java/io/split/android/client/TreatmentManagerWithFlagSetsTest.java @@ -439,4 +439,40 @@ public void getTreatmentsWithConfigByFlagSetsRecordsTelemetry() { verify(mTelemetryStorageProducer).recordLatency(eq(Method.TREATMENTS_WITH_CONFIG_BY_FLAG_SETS), anyLong()); } + + @Test + public void getTreatmentsByFlagSetExceptionIsRecordedInTelemetry() { + when(mSplitsStorage.getNamesByFlagSets(any())).thenThrow(new RuntimeException("test")); + + mTreatmentManager.getTreatmentsByFlagSet("set_1", null, false); + + verify(mTelemetryStorageProducer).recordException(eq(Method.TREATMENTS_BY_FLAG_SET)); + } + + @Test + public void getTreatmentsByFlagSetsExceptionIsRecordedInTelemetry() { + when(mSplitsStorage.getNamesByFlagSets(any())).thenThrow(new RuntimeException("test")); + + mTreatmentManager.getTreatmentsByFlagSets(Arrays.asList("set_1", "set_2"), null, false); + + verify(mTelemetryStorageProducer).recordException(eq(Method.TREATMENTS_BY_FLAG_SETS)); + } + + @Test + public void getTreatmentsWithConfigByFlagSetExceptionIsRecordedInTelemetry() { + when(mSplitsStorage.getNamesByFlagSets(any())).thenThrow(new RuntimeException("test")); + + mTreatmentManager.getTreatmentsWithConfigByFlagSet("set_1", null, false); + + verify(mTelemetryStorageProducer).recordException(eq(Method.TREATMENTS_WITH_CONFIG_BY_FLAG_SET)); + } + + @Test + public void getTreatmentsWithConfigByFlagSetsExceptionIsRecordedInTelemetry() { + when(mSplitsStorage.getNamesByFlagSets(any())).thenThrow(new RuntimeException("test")); + + mTreatmentManager.getTreatmentsWithConfigByFlagSets(Arrays.asList("set_1", "set_2"), null, false); + + verify(mTelemetryStorageProducer).recordException(eq(Method.TREATMENTS_WITH_CONFIG_BY_FLAG_SETS)); + } }