xabgesagtx / telegram-spring-boot-starter

Telegram Bot API Spring Boot Starter
MIT License
127 stars 41 forks source link

how to make junit #4

Closed rgf2004 closed 6 years ago

rgf2004 commented 6 years ago

in case of start the application for JUNIT the application is trying to register the bot which is not the case in testing, so how I can stop register the bot while start the application for testing >

rgf2004 commented 6 years ago

I've fixed it by this code in Junit class @MockBean TelegramBotAutoConfiguration telegramBotAutoConfiguration; @Before public void setup() { try { doNothing ().when ( telegramBotAutoConfiguration ).start (); } catch (Exception e) { e.printStackTrace (); } }

xabgesagtx commented 6 years ago

Thanks for sharing. I hope I'll find some time to look into the underlying issue