Getting Started tutorial improvements (#23210)
This commit is contained in:
parent
d87cf4aec4
commit
f38b928e13
67 changed files with 1451 additions and 1507 deletions
|
|
@ -3,9 +3,7 @@
|
|||
*/
|
||||
package jdocs.tutorial_3;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.testkit.javadsl.TestKit;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
|
@ -14,7 +12,9 @@ import static org.junit.Assert.assertEquals;
|
|||
|
||||
import org.scalatest.junit.JUnitSuite;
|
||||
|
||||
import java.util.Optional;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.testkit.javadsl.TestKit;
|
||||
|
||||
public class DeviceTest extends JUnitSuite {
|
||||
|
||||
|
|
@ -31,30 +31,6 @@ public class DeviceTest extends JUnitSuite {
|
|||
system = null;
|
||||
}
|
||||
|
||||
//#device-registration-tests
|
||||
@Test
|
||||
public void testReplyToRegistrationRequests() {
|
||||
TestKit probe = new TestKit(system);
|
||||
ActorRef deviceActor = system.actorOf(Device.props("group", "device"));
|
||||
|
||||
deviceActor.tell(new DeviceManager.RequestTrackDevice("group", "device"), probe.getRef());
|
||||
probe.expectMsgClass(DeviceManager.DeviceRegistered.class);
|
||||
assertEquals(deviceActor, probe.getLastSender());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreWrongRegistrationRequests() {
|
||||
TestKit probe = new TestKit(system);
|
||||
ActorRef deviceActor = system.actorOf(Device.props("group", "device"));
|
||||
|
||||
deviceActor.tell(new DeviceManager.RequestTrackDevice("wrongGroup", "device"), probe.getRef());
|
||||
probe.expectNoMsg();
|
||||
|
||||
deviceActor.tell(new DeviceManager.RequestTrackDevice("group", "wrongDevice"), probe.getRef());
|
||||
probe.expectNoMsg();
|
||||
}
|
||||
//#device-registration-tests
|
||||
|
||||
//#device-read-test
|
||||
@Test
|
||||
public void testReplyWithEmptyReadingIfNoTemperatureIsKnown() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue