generated from l3r8yJ/elegant
-
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.
- Loading branch information
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/test/java/io/blamer/bot/answer/generator/impl/StartMessageGeneratorTest.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 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) Copyright (c) 2023 Blamer.io | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package io.blamer.bot.answer.generator.impl; | ||
|
||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.Mockito; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
import org.telegram.telegrambots.meta.api.objects.Message; | ||
import org.telegram.telegrambots.meta.api.objects.Update; | ||
import org.telegram.telegrambots.meta.api.objects.commands.BotCommand; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class StartMessageGeneratorTest { | ||
|
||
@Test | ||
void createsStartMessage(@Mock final Update update, @Mock final Message message) { | ||
Mockito.when(update.getMessage()).thenReturn(message); | ||
Assertions.assertNotNull(new StartMessageGenerator().messageFromUpdate(update)); | ||
} | ||
|
||
@Test | ||
void createsDescription() { | ||
final BotCommand actual = new StartMessageGenerator().messageAsBotCommand(); | ||
MatcherAssert.assertThat(actual.getCommand(), Matchers.equalTo("/start")); | ||
MatcherAssert.assertThat( | ||
actual.getDescription(), | ||
Matchers.equalTo("Just start command") | ||
); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/test/java/io/blamer/bot/answer/generator/impl/TokenMessageGeneratorTest.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 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) Copyright (c) 2023 Blamer.io | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package io.blamer.bot.answer.generator.impl; | ||
|
||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.Mockito; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
import org.telegram.telegrambots.meta.api.objects.Message; | ||
import org.telegram.telegrambots.meta.api.objects.Update; | ||
import org.telegram.telegrambots.meta.api.objects.commands.BotCommand; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class TokenMessageGeneratorTest { | ||
|
||
@Test | ||
void createsStartMessage(@Mock final Update update, @Mock final Message message) { | ||
Mockito.when(update.getMessage()).thenReturn(message); | ||
Assertions.assertNotNull(new TokenMessageGenerator().messageFromUpdate(update)); | ||
} | ||
|
||
@Test | ||
void createsDescription() { | ||
final BotCommand actual = new TokenMessageGenerator().messageAsBotCommand(); | ||
MatcherAssert.assertThat(actual.getCommand(), Matchers.equalTo("/token")); | ||
MatcherAssert.assertThat( | ||
actual.getDescription(), | ||
Matchers.equalTo("Set GitHub token to get updates") | ||
); | ||
} | ||
} |
c78df2b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
1-e16aaf49
disappeared fromsrc/main/java/io/blamer/bot/bot/Bot.java
), that's why I closed #4. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.c78df2b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
4-3e287310
discovered insrc/main/java/io/blamer/bot/answer/generator/MessageGenerator.java
) and submitted as #9. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.c78df2b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
4-2e64d6dc
discovered insrc/main/java/io/blamer/bot/bot/Bot.java
) and submitted as #10. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.