-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #425 from deutschebank/spring-bot-master-db
Test case for upload file feature
- Loading branch information
Showing
5 changed files
with
394 additions
and
52 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
26 changes: 0 additions & 26 deletions
26
...g-boot-starter/src/main/java/org/finos/springbot/teams/state/FileStateStorageUtility.java
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
57 changes: 57 additions & 0 deletions
57
...ng-boot-starter/src/test/java/org/finos/springbot/teams/controller/BotControllerTest.java
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,57 @@ | ||
package org.finos.springbot.teams.controller; | ||
|
||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
import org.finos.springbot.teams.MockTeamsConfiguration; | ||
import org.finos.springbot.teams.bot.BotController; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.Mockito; | ||
import org.mockito.Spy; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
import com.microsoft.bot.builder.Bot; | ||
import com.microsoft.bot.builder.InvokeResponse; | ||
import com.microsoft.bot.integration.BotFrameworkHttpAdapter; | ||
import com.microsoft.bot.schema.Activity; | ||
|
||
@SpringBootTest(classes = { MockTeamsConfiguration.class}) | ||
@ActiveProfiles("teams") | ||
@ExtendWith(SpringExtension.class) | ||
public class BotControllerTest { | ||
|
||
@Mock | ||
BotFrameworkHttpAdapter adapter; | ||
|
||
@Spy | ||
Bot bot; | ||
|
||
@InjectMocks | ||
BotController controller; | ||
|
||
|
||
@SuppressWarnings({ "deprecation" }) | ||
@Test | ||
public void testIncoming() throws InterruptedException, ExecutionException { | ||
Activity a = Mockito.mock(Activity.class); | ||
InvokeResponse ir = new InvokeResponse(HttpStatus.OK.value(), "Success"); | ||
Mockito.when(adapter.processIncomingActivity("any text", a, bot)).thenReturn(CompletableFuture.completedFuture(ir)); | ||
CompletableFuture<ResponseEntity<Object>> future = controller.incoming(a, "any text"); | ||
|
||
ResponseEntity<Object> entity = future.get(); | ||
|
||
Assertions.assertEquals(200, entity.getStatusCodeValue()); | ||
Assertions.assertEquals("Success", entity.getBody()); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.