diff options
author | Håkon Hallingstad <hakon@oath.com> | 2018-06-22 11:01:22 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@oath.com> | 2018-06-22 11:01:22 +0200 |
commit | da8720586341957f15bf6a42b291d879c8569538 (patch) | |
tree | 29bb114ffbc6bb5bdd4a048e53845df00f449e08 /clustercontroller-utils/src/test/java | |
parent | d17e36f062c38550a96ccee3e41d7ff5266efecb (diff) |
set-node-state timeout in CC
Diffstat (limited to 'clustercontroller-utils/src/test/java')
-rw-r--r-- | clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/server/JsonReaderTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/server/JsonReaderTest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/server/JsonReaderTest.java new file mode 100644 index 00000000000..bf47a6605a2 --- /dev/null +++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/server/JsonReaderTest.java @@ -0,0 +1,20 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.clustercontroller.utils.staterestapi.server; + +import com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InvalidContentException; +import org.junit.Test; + +import java.time.Duration; +import java.util.Optional; + +import static org.junit.Assert.assertEquals; + +public class JsonReaderTest { + @Test + public void testParsingOfTimeout() throws InvalidContentException { + assertEquals(Optional.empty(), JsonReader.parseTimeout(null)); + assertEquals(Optional.of(Duration.ofMillis(12500)), JsonReader.parseTimeout("12.5")); + assertEquals(Optional.of(Duration.ofMillis(0)), JsonReader.parseTimeout("-1")); + assertEquals(Optional.of(Duration.ofMillis(0)), JsonReader.parseTimeout("0.0001")); + } +}
\ No newline at end of file |