+tes #16431 support for TestProbe with user-defined name

This commit is contained in:
Paweł Wiejacha 2014-12-04 22:42:40 +01:00
parent 49d9082851
commit f480989b25
6 changed files with 55 additions and 6 deletions

View file

@ -285,6 +285,19 @@ public class TestKitDocTest {
//#test-probe
}
@Test
public void demonstrateTestProbeWithCustomName() {
//#test-probe-with-custom-name
new JavaTestKit(system) {{
final TestProbe worker = new TestProbe(system, "worker");
final TestProbe aggregator = new TestProbe(system, "aggregator");
assertTrue(worker.ref().path().name().startsWith("worker"));
assertTrue(aggregator.ref().path().name().startsWith("aggregator"));
}};
//#test-probe-with-custom-name
}
@Test
public void demonstrateSpecialProbe() {
//#test-special-probe

View file

@ -388,6 +388,11 @@ flow, a :class:`TestProbe` could be inserted as target of A, using the
forwarding capabilities or auto-pilot described below to include a real B in
the test setup.
If you have many test probes, you can name them to get meaningful actor names
in test logs and assertions:
.. includecode:: code/docs/testkit/TestKitDocTest.java#test-probe-with-custom-name
Probes may also be equipped with custom assertions to make your test code even
more concise and clear: