add hasNoReply method on CommandResult (#31277)
This commit is contained in:
parent
f8d7e0fb34
commit
ec567fbbce
4 changed files with 23 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ import akka.pattern.StatusReply;
|
|||
import org.scalatestplus.junit.JUnitSuite;
|
||||
|
||||
import static jdocs.akka.cluster.sharding.typed.AccountExampleWithEventHandlersInState.AccountEntity;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
// #test
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -23,8 +24,6 @@ import org.junit.Before;
|
|||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
// #test
|
||||
|
||||
|
|
@ -64,6 +63,14 @@ public class AccountExampleDocTest
|
|||
assertEquals(BigDecimal.ZERO, result.stateOfType(AccountEntity.OpenedAccount.class).balance);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createWithUnHandle() {
|
||||
CommandResultWithReply<
|
||||
AccountEntity.Command, AccountEntity.Event, AccountEntity.Account, StatusReply<Done>>
|
||||
result = eventSourcedTestKit.runCommand(AccountEntity.CreateAccount::new);
|
||||
assertFalse(result.hasNoReply());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleWithdraw() {
|
||||
eventSourcedTestKit.runCommand(AccountEntity.CreateAccount::new);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ import akka.stream.scaladsl.Sink
|
|||
s"but was [${other.getClass.getName}]")
|
||||
}
|
||||
}
|
||||
|
||||
override def hasNoReply: Boolean = replyOption.isEmpty
|
||||
}
|
||||
|
||||
final case class RestartResultImpl[State](state: State) extends RestartResult[State]
|
||||
|
|
|
|||
|
|
@ -186,6 +186,12 @@ object EventSourcedBehaviorTestKit {
|
|||
*/
|
||||
def replyOfType[R <: Reply](replyClass: Class[R]): R =
|
||||
delegate.replyOfType(ClassTag[R](replyClass))
|
||||
|
||||
/**
|
||||
* `true` if there is no reply.
|
||||
*/
|
||||
def hasNoReply: Boolean = delegate.hasNoReply
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -172,6 +172,12 @@ object EventSourcedBehaviorTestKit {
|
|||
* if the reply is of a different type.
|
||||
*/
|
||||
def replyOfType[R <: Reply: ClassTag]: R
|
||||
|
||||
/**
|
||||
* `true` if there is no reply.
|
||||
*/
|
||||
def hasNoReply: Boolean
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue