Commit 38dd5680 authored by Jean Meurice's avatar Jean Meurice
Browse files

orElseThrow() fix

parent 720d4119
Pipeline #381081 passed with stage
in 1 minute and 5 seconds
......@@ -2,6 +2,7 @@ package de.rwth.montisim.simulation.eecomponents.simple_network;
import java.time.Duration;
import java.time.Instant;
import java.util.NoSuchElementException;
import java.util.Optional;
import org.junit.Assert;
......@@ -106,12 +107,12 @@ public class CommunicationTest {
Vehicle v3 = prop3.build(context);
Vehicle v4 = prop4.build(context);
TestEEComponent testComp1 = (TestEEComponent) v1.eesystem.getComponent("TestComp1").orElseThrow();
TestEEComponent testComp2 = (TestEEComponent) v2.eesystem.getComponent("TestComp2").orElseThrow();
TestEEComponent testComp3 = (TestEEComponent) v3.eesystem.getComponent("TestComp3").orElseThrow();
TestEEComponent testComp4 = (TestEEComponent) v4.eesystem.getComponent("TestComp4").orElseThrow();
TestEEComponent testComp1 = (TestEEComponent) v1.eesystem.getComponent("TestComp1").orElseThrow(() -> new NoSuchElementException());
TestEEComponent testComp2 = (TestEEComponent) v2.eesystem.getComponent("TestComp2").orElseThrow(() -> new NoSuchElementException());
TestEEComponent testComp3 = (TestEEComponent) v3.eesystem.getComponent("TestComp3").orElseThrow(() -> new NoSuchElementException());
TestEEComponent testComp4 = (TestEEComponent) v4.eesystem.getComponent("TestComp4").orElseThrow(() -> new NoSuchElementException());
IPV6Address v1addr = ((SimpleCommunicationGateway) v1.eesystem.getComponent(SCGProperties.COMPONENT_NAME).orElseThrow()).address;
IPV6Address v1addr = ((SimpleCommunicationGateway) v1.eesystem.getComponent(SCGProperties.COMPONENT_NAME).orElseThrow(() -> new NoSuchElementException())).address;
// Send messages
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment