Skip to content

Commit

Permalink
Rename WebhookBot
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalijr2 committed Oct 26, 2024
1 parent 1234e2b commit 6a344bd
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.cloud.functions.HttpFunction;
import com.google.cloud.functions.HttpRequest;
import com.google.cloud.functions.HttpResponse;
import io.github.vitalijr2.telegram.webhookbot.TelegramWebhookBot;
import io.github.vitalijr2.telegram.webhookbot.WebhookBot;
import java.io.BufferedReader;
import java.io.IOException;
import java.lang.System.Logger.Level;
Expand All @@ -19,14 +19,14 @@ public class TelegramWebhookFunction implements HttpFunction {
private static final String HTTP_POST_METHOD = "POST";

private final System.Logger logger = System.getLogger(getClass().getName());
private final TelegramWebhookBot webhookBot;
private final WebhookBot webhookBot;

public TelegramWebhookFunction() {
this(TelegramWebhookBot.getInstance());
this(WebhookBot.getInstance());
}

@VisibleForTesting
TelegramWebhookFunction(TelegramWebhookBot webhookBot) {
TelegramWebhookFunction(WebhookBot webhookBot) {
this.webhookBot = webhookBot;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import com.google.cloud.functions.HttpRequest;
import com.google.cloud.functions.HttpResponse;
import io.github.vitalijr2.mock.jdk.platform.logging.MockLoggerExtension;
import io.github.vitalijr2.telegram.webhookbot.TelegramWebhookBot;
import io.github.vitalijr2.telegram.webhookbot.WebhookBot;
import java.io.BufferedReader;
import java.io.CharArrayReader;
import java.io.IOException;
Expand Down Expand Up @@ -46,7 +46,7 @@ class TelegramWebhookFunctionFastTest {
@Mock
private HttpResponse httpResponse;
@Mock
private TelegramWebhookBot webhookBot;
private WebhookBot webhookBot;

@InjectMocks
@Spy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package test.provider;

import io.github.vitalijr2.telegram.webhookbot.TelegramWebhookBot;
import io.github.vitalijr2.telegram.webhookbot.WebhookBot;
import java.io.Reader;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;

public class TestServiceProvider implements TelegramWebhookBot {
public class TestServiceProvider implements WebhookBot {

@Override
public @NotNull Optional<String> processPayload(@NotNull Reader payloadReader) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
/**
* Telegram Webhook Bot
*/
public interface TelegramWebhookBot {
public interface WebhookBot {

/**
* Find and load a service provider of {@link TelegramWebhookBot}
* Find and load a service provider of {@link WebhookBot}
*
* @return the Telegram bot instance.
*/
@NotNull
static TelegramWebhookBot getInstance() {
return WebhookTools.getTelegramWebhookBot(TelegramWebhookBot.class);
static WebhookBot getInstance() {
return WebhookTools.getTelegramWebhookBot(WebhookBot.class);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class WebhookTools {
private WebhookTools() {
}

static TelegramWebhookBot getTelegramWebhookBot(Class<? extends TelegramWebhookBot> clazz) {
static WebhookBot getTelegramWebhookBot(Class<? extends WebhookBot> clazz) {
return ServiceLoader.load(clazz).findFirst()
.orElseThrow(() -> new IllegalStateException("Unable to find a TelegramWebhookBot implementation"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TelegramWebhookBotTest {
@Test
void getInstance() {
// when and then
assertNotNull(assertDoesNotThrow(TelegramWebhookBot::getInstance));
assertNotNull(assertDoesNotThrow(WebhookBot::getInstance));
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package test.provider;

import io.github.vitalijr2.telegram.webhookbot.TelegramWebhookBot;
import io.github.vitalijr2.telegram.webhookbot.WebhookBot;

public interface FakeServiceProvider extends TelegramWebhookBot {
public interface FakeServiceProvider extends WebhookBot {

String hello();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package test.provider;

import io.github.vitalijr2.telegram.webhookbot.TelegramWebhookBot;
import io.github.vitalijr2.telegram.webhookbot.WebhookBot;

public interface TestServiceProvider extends TelegramWebhookBot {
public interface TestServiceProvider extends WebhookBot {

String hello();

Expand Down

0 comments on commit 6a344bd

Please sign in to comment.