-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#25 change messageSendText return Future
- Loading branch information
Showing
14 changed files
with
128 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
wechaty-puppet-padplus/src/test/scala/wechaty/padplus/support/MessageRawSupportTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package wechaty.padplus.support | ||
|
||
import org.grpcmock.GrpcMock.{stubFor, unaryMethod} | ||
import org.junit.jupiter.api.{Assertions, Test} | ||
import wechaty.padplus.PadplusTestEventBase | ||
import wechaty.padplus.grpc.PadPlusServerGrpc | ||
import wechaty.padplus.grpc.PadPlusServerOuterClass.{ResponseObject, ResponseType} | ||
import wechaty.padplus.schemas.GrpcSchemas.GrpcMessagePayload | ||
import wechaty.padplus.schemas.PadplusEnums.PadplusMessageType | ||
|
||
import scala.concurrent.Await | ||
import scala.concurrent.duration._ | ||
|
||
/** | ||
* | ||
* @author <a href="mailto:jcai@ganshane.com">Jun Tsai</a> | ||
* @since 2020-07-02 | ||
*/ | ||
class MessageRawSupportTest extends PadplusTestEventBase { | ||
@Test | ||
def test_sendMessage: Unit ={ | ||
val responseBuilder = ResponseObject.newBuilder.setResult("success") | ||
stubFor(unaryMethod(PadPlusServerGrpc.getRequestMethod) | ||
.willReturn(responseBuilder.build())) | ||
|
||
val future = instance.messageSendText("roomId","test",Array()) | ||
|
||
val grpcContact = new GrpcMessagePayload | ||
grpcContact.MsgId= "msgId" | ||
grpcContact.MsgType = PadplusMessageType.Text.id | ||
mockEvent(ResponseType.REQUEST_RESPONSE -> grpcContact) | ||
|
||
val payload = Await.result(future, 10 seconds) | ||
Assertions.assertEquals("msgId", payload) | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.