import akka.actor.UntypedActor;
import akka.pattern.Patterns;
import akka.util.Timeout;
+import com.google.common.collect.Lists;
import scala.concurrent.Await;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
* @param clazz
* @return
*/
- public static Object getFirstMatching(ActorRef actor, Class clazz) throws Exception {
+ public static Object getFirstMatching(ActorRef actor, Class<?> clazz) throws Exception {
List<Object> allMessages = getAllMessages(actor);
for(Object message : allMessages){
return null;
}
+ public static List<Object> getAllMatching(ActorRef actor, Class<?> clazz) throws Exception {
+ List<Object> allMessages = getAllMessages(actor);
+
+ List<Object> output = Lists.newArrayList();
+
+ for(Object message : allMessages){
+ if(message.getClass().equals(clazz)){
+ output.add(message);
+ }
+ }
+
+ return output;
+ }
+
}