Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
[#562] cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Pozzi committed Jun 23, 2021
1 parent abd038c commit 05ad419
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions src/test/java/de/bonndan/nivio/assessment/kpi/CustomKPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import static de.bonndan.nivio.model.ItemFactory.getTestItem;
Expand All @@ -26,34 +29,23 @@ void setup() {
kpiConfig.label = LABEL;
}

@Test
void testWithRanges1() {
@ParameterizedTest
@CsvSource({
"2.58, green",
"0, green",
"10.1, yellow",
})
void testWithRanges1(String value, String status) {
CustomKPI test = new CustomKPI();
kpiConfig.ranges = getRangeMap();
test.init(kpiConfig);
StatusValue statusValue = test.getStatusValues(getComponent("2.58")).get(0);
assertNotNull(statusValue);
Assertions.assertEquals(Status.GREEN, statusValue.getStatus());
}

@Test
void testWithRanges2() {
CustomKPI test = new CustomKPI();
kpiConfig.ranges = getRangeMap();
test.init(kpiConfig);
StatusValue statusValue = test.getStatusValues(getComponent("0")).get(0);
assertNotNull(statusValue);
Assertions.assertEquals(Status.GREEN, statusValue.getStatus());
}
//when
StatusValue statusValue = test.getStatusValues(getComponent(value)).get(0);

@Test
void testWithRanges3() {
CustomKPI test = new CustomKPI();
kpiConfig.ranges = getRangeMap();
test.init(kpiConfig);
StatusValue statusValue = test.getStatusValues(getComponent("10.1")).get(0);
//then
assertNotNull(statusValue);
Assertions.assertEquals(Status.YELLOW, statusValue.getStatus());
Assertions.assertEquals(status, statusValue.getStatus().getName().toLowerCase(Locale.ROOT));
}

@Test
Expand Down

0 comments on commit 05ad419

Please sign in to comment.