]> git.basschouten.com Git - openhab-addons.git/commitdiff
[teleinfo] Try to make tests more stable (#9303)
authorFabian Wolter <github@fabian-wolter.de>
Sun, 13 Dec 2020 15:26:12 +0000 (16:26 +0100)
committerGitHub <noreply@github.com>
Sun, 13 Dec 2020 15:26:12 +0000 (16:26 +0100)
Signed-off-by: Fabian Wolter <github@fabian-wolter.de>
bundles/org.openhab.binding.teleinfo/src/test/java/org/openhab/binding/teleinfo/internal/reader/io/TeleinfoInputStreamTest.java

index 9474bf485a05c5160a047900924908e5f0f6a104..5149a918e149a9d9acd0ec75905f64c7c76bd580 100644 (file)
@@ -36,11 +36,12 @@ import org.openhab.binding.teleinfo.util.TestUtils;
  */
 @NonNullByDefault
 public class TeleinfoInputStreamTest {
+    private static final int TIMEOUT_US = 5000000;
 
     @Test
     public void testReadNextFrameCbetmBase1() throws Exception {
         try (TeleinfoInputStream in = new TeleinfoInputStream(
-                new FileInputStream(TestUtils.getTestFile("cbetm-base-option-1.raw")))) {
+                new FileInputStream(TestUtils.getTestFile("cbetm-base-option-1.raw")), TIMEOUT_US, TIMEOUT_US, false)) {
             Frame frame = in.readNextFrame();
 
             assertNotNull(frame);
@@ -65,7 +66,8 @@ public class TeleinfoInputStreamTest {
     @Test
     public void testReadNextFrameCbemmEvoIccHc1() throws Exception {
         try (TeleinfoInputStream in = new TeleinfoInputStream(
-                new FileInputStream(TestUtils.getTestFile("cbemm-evo-icc-hc-option-1.raw")))) {
+                new FileInputStream(TestUtils.getTestFile("cbemm-evo-icc-hc-option-1.raw")), TIMEOUT_US, TIMEOUT_US,
+                false)) {
             Frame frame = in.readNextFrame();
 
             assertNotNull(frame);
@@ -87,7 +89,7 @@ public class TeleinfoInputStreamTest {
     @Test
     public void testReadNextFrameCbetmEjp1() throws Exception {
         try (TeleinfoInputStream in = new TeleinfoInputStream(
-                new FileInputStream(TestUtils.getTestFile("cbetm-ejp-option-1.raw")))) {
+                new FileInputStream(TestUtils.getTestFile("cbetm-ejp-option-1.raw")), TIMEOUT_US, TIMEOUT_US, false)) {
             Frame frame = in.readNextFrame();
 
             assertNotNull(frame);
@@ -114,7 +116,8 @@ public class TeleinfoInputStreamTest {
     @Test
     public void testReadNextFrameCbemmEvoIccTempo1() throws Exception {
         try (TeleinfoInputStream in = new TeleinfoInputStream(
-                new FileInputStream(TestUtils.getTestFile("cbemm-evo-icc-tempo-option-1.raw")))) {
+                new FileInputStream(TestUtils.getTestFile("cbemm-evo-icc-tempo-option-1.raw")), TIMEOUT_US, TIMEOUT_US,
+                false)) {
             Frame frame = in.readNextFrame();
 
             assertNotNull(frame);
@@ -143,7 +146,8 @@ public class TeleinfoInputStreamTest {
     @Test
     public void testReadNextFrameCbemmEvoIccBase1() throws Exception {
         try (TeleinfoInputStream in = new TeleinfoInputStream(
-                new FileInputStream(TestUtils.getTestFile("cbemm-evo-icc-base-option-1.raw")))) {
+                new FileInputStream(TestUtils.getTestFile("cbemm-evo-icc-base-option-1.raw")), TIMEOUT_US, TIMEOUT_US,
+                false)) {
             Frame frame = in.readNextFrame();
             assertNotNull(frame);
             assertEquals(FrameCbemmEvolutionIccBaseOption.class, frame.getClass());
@@ -162,7 +166,8 @@ public class TeleinfoInputStreamTest {
     @Test
     public void testInvalidADPSgrouplineWithAutoRepairActivated() throws Exception {
         try (TeleinfoInputStream in = new TeleinfoInputStream(
-                new FileInputStream(TestUtils.getTestFile("invalid-adps-groupline.raw")), true)) {
+                new FileInputStream(TestUtils.getTestFile("invalid-adps-groupline.raw")), TIMEOUT_US, TIMEOUT_US,
+                true)) {
             Frame frame = in.readNextFrame();
 
             assertNotNull(frame);