|
4 | 4 | import com.pengrad.telegrambot.model.request.*; |
5 | 5 | import com.pengrad.telegrambot.request.*; |
6 | 6 | import com.pengrad.telegrambot.response.*; |
| 7 | +import okhttp3.OkHttpClient; |
| 8 | +import okhttp3.Request; |
| 9 | +import okhttp3.Response; |
7 | 10 | import org.junit.Test; |
8 | 11 |
|
9 | 12 | import java.io.File; |
@@ -45,6 +48,7 @@ public class TelegramBotTest { |
45 | 48 | String videoFileId = "BAADAgADZAADuYNZSXhLnzJTZ2yvAg"; |
46 | 49 | String photoFileId = "AgADAgADDKgxG7mDWUlvyFIJ9XfF9yszSw0ABBhVadWwbAK1z-wIAAEC"; |
47 | 50 | String gifFileId = "CgADAgADfQADgNqgSTt9SzatJhc3Ag"; |
| 51 | + String withSpaceFileId = "BAADAgADZwADkg-4SQI5WM0SPNHrAg"; |
48 | 52 |
|
49 | 53 | public TelegramBotTest() throws IOException { |
50 | 54 | String token, chat, forwardMessage, sticker; |
@@ -91,11 +95,14 @@ public void getUpdates() { |
91 | 95 | } |
92 | 96 |
|
93 | 97 | @Test |
94 | | - public void getFile() { |
95 | | - GetFileResponse response = bot.execute(new GetFile(audioFileId)); |
| 98 | + public void getFile() throws IOException { |
| 99 | + GetFileResponse response = bot.execute(new GetFile(withSpaceFileId)); |
96 | 100 | FileTest.check(response.file()); |
97 | 101 | String path = bot.getFullFilePath(response.file()); |
98 | | - assertTrue(path.contains(response.file().filePath())); |
| 102 | + |
| 103 | + Request request = new Request.Builder().head().url(path).build(); |
| 104 | + Response pathResponse = new OkHttpClient().newCall(request).execute(); |
| 105 | + assertTrue(pathResponse.isSuccessful()); |
99 | 106 | } |
100 | 107 |
|
101 | 108 | @Test |
|
0 commit comments