Skip to content

Commit

Permalink
Dodged another exception (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Dec 29, 2023
1 parent f595dcc commit 4fbb955
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private Signal<Double, Void> convert(Signal<String, Void> signal) {

return new Signal<>(signal.timestamp, value);

} catch (JsonProcessingException ex) {
} catch (JsonProcessingException | NumberFormatException ex) {

// Throwing an exception here breaks everything
// https://github.com/home-climate-control/dz/issues/303
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.time.Clock;
import java.time.Duration;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;

@EnabledIfEnvironmentVariable(
Expand Down Expand Up @@ -72,4 +73,15 @@ void setState1010() {

}).doesNotThrowAnyException();
}

@Test
void parseBinary() {
assertThat(Boolean.valueOf("TRUE")).isTrue();
assertThat(Boolean.valueOf("true")).isTrue();
assertThat(Boolean.valueOf("false")).isFalse();

assertThat(Boolean.valueOf(null)).isFalse();
assertThat(Boolean.valueOf("")).isFalse();
assertThat(Boolean.valueOf("what's that?")).isFalse();
}
}

0 comments on commit 4fbb955

Please sign in to comment.