@CheckForNull
@VisibleForTesting
static String convertDuration(@Nullable Double oldValue, @Nullable String oldUnit) {
- if (oldValue != null) {
+ if (oldValue != null && oldValue > 0) {
String unit = oldUnit != null ? oldUnit : Duration.DAY;
// min is replaced by mn
unit = "mn".equals(unit) ? Duration.MINUTE : unit;
assertThat(CopyRequirementsFromCharacteristicsToRules.convertDuration(1.0, null)).isEqualTo("1d");
assertThat(CopyRequirementsFromCharacteristicsToRules.convertDuration(null, "d")).isNull();
+
+ assertThat(CopyRequirementsFromCharacteristicsToRules.convertDuration(0.0, "d")).isNull();
}
@Test