ThingPersistenceActor extends AbstractShardedPersistenceActor<Command, Thing, ThingId, ThingId, ThingEvent> { public static Props props(final ThingId thingId, final DistributedPub<ThingEvent> distributedPub, final SnapshotAdapter<Thing> snapshotAdapter) { return Props.create(ThingPersistenceActor.class, thingId, distributedPub, snapshotAdapter); } @SuppressWarnings("unused") private  ThingPersistenceActor(final ThingId thingId, final DistributedPub<ThingEvent> distributedPub,
            final SnapshotAdapter<Thing> snapshotAdapter); static Props props(final ThingId thingId, final DistributedPub<ThingEvent> distributedPub,
            final SnapshotAdapter<Thing> snapshotAdapter); static Props props(final ThingId thingId, final DistributedPub<ThingEvent> distributedPub); @Override String persistenceId(); @Override String journalPluginId(); @Override String snapshotPluginId();  }
@Test public void tryToCreateThingWithDifferentThingId() { final ThingId thingIdOfActor = ThingId.of("test.ns", "23420815"); final Thing thing = createThingV2WithRandomId(); final CreateThing createThing = CreateThing.of(thing, null, dittoHeadersV2); final Props props = ThingPersistenceActor.props(thingIdOfActor, getDistributedPub()); final TestActorRef<ThingPersistenceActor> underTest = TestActorRef.create(actorSystem, props); final ThingPersistenceActor thingPersistenceActor = underTest.underlyingActor(); final PartialFunction<Object, BoxedUnit> receiveCommand = thingPersistenceActor.receiveCommand(); try { receiveCommand.apply(createThing); fail("Expected IllegalArgumentException to be thrown."); } catch (final Exception e) { assertThat(e).isInstanceOf(IllegalArgumentException.class); } }