From 90fd09da419d4f2bde3ffe9d32287fa7129055aa Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Fri, 22 Mar 2024 16:17:48 +0900 Subject: [PATCH] fix: Add SdkConfiguration class and install method to DeployGate in mock test: Add a new testcase that uses these entities --- .../sdk/DeployGateInterfaceTest.java | 36 +++++++++++++++ .../java/com/deploygate/sdk/DeployGate.java | 10 +++++ .../sdk/DeployGateSdkConfiguration.java | 44 +++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 sdkMock/src/main/java/com/deploygate/sdk/DeployGateSdkConfiguration.java diff --git a/sdk/src/test/java/com/deploygate/sdk/DeployGateInterfaceTest.java b/sdk/src/test/java/com/deploygate/sdk/DeployGateInterfaceTest.java index e5d4e15..90622bc 100644 --- a/sdk/src/test/java/com/deploygate/sdk/DeployGateInterfaceTest.java +++ b/sdk/src/test/java/com/deploygate/sdk/DeployGateInterfaceTest.java @@ -60,6 +60,42 @@ public void onUpdateAvailable( DeployGate.clear(); } + @Test + public void install__Context_SdkConfiguration() { + DeployGate.install( + app, + new DeployGateSdkConfiguration.Builder() + .setCaptureEnabled(false) + .setDisabled(false) + .setEnabledOnNonDebuggableBuild(false) + .setAppOwnerName("sample") + .setCrashReportingEnabled(false) + .setCustomLogConfiguration( + new CustomLogConfiguration.Builder() + .setBackpressure(CustomLogConfiguration.Backpressure.DROP_BUFFER_BY_OLDEST) + .setBufferSize(5) + .build() + ) + .setCallback(new DeployGateCallback() { + @Override + public void onInitialized(boolean isServiceAvailable) { + + } + + @Override + public void onStatusChanged(boolean isManaged, boolean isAuthorized, String loginUsername, boolean isStopped) { + + } + + @Override + public void onUpdateAvailable(int revision, String versionName, int versionCode) { + + } + }) + .build() + ); + } + @Test public void install__Application() { DeployGate.install(app); diff --git a/sdkMock/src/main/java/com/deploygate/sdk/DeployGate.java b/sdkMock/src/main/java/com/deploygate/sdk/DeployGate.java index c3e1cc1..3ea6c62 100644 --- a/sdkMock/src/main/java/com/deploygate/sdk/DeployGate.java +++ b/sdkMock/src/main/java/com/deploygate/sdk/DeployGate.java @@ -1,12 +1,22 @@ package com.deploygate.sdk; import android.app.Application; +import android.content.Context; +/** + * @noinspection ALL + */ public class DeployGate { static void clear() { } + public static void install( + Context context, + DeployGateSdkConfiguration sdkConfiguration + ) { + } + public static void install(Application app) { } diff --git a/sdkMock/src/main/java/com/deploygate/sdk/DeployGateSdkConfiguration.java b/sdkMock/src/main/java/com/deploygate/sdk/DeployGateSdkConfiguration.java new file mode 100644 index 0000000..4fc3956 --- /dev/null +++ b/sdkMock/src/main/java/com/deploygate/sdk/DeployGateSdkConfiguration.java @@ -0,0 +1,44 @@ +package com.deploygate.sdk; + +/** @noinspection ALL*/ +public final class DeployGateSdkConfiguration { + private DeployGateSdkConfiguration() { + } + + public static final class Builder { + public Builder() { + } + + public Builder setCustomLogConfiguration(CustomLogConfiguration customLogConfiguration) { + return this; + } + + public Builder setAppOwnerName(String appOwnerName) { + return this; + } + + public Builder setDisabled(boolean disabled) { + return this; + } + + public Builder setEnabledOnNonDebuggableBuild(boolean enabledOnNonDebuggableBuild) { + return this; + } + + public Builder setCaptureEnabled(boolean captureEnabled) { + return this; + } + + public Builder setCrashReportingEnabled(boolean crashReportingEnabled) { + return this; + } + + public Builder setCallback(DeployGateCallback callback) { + return this; + } + + public DeployGateSdkConfiguration build() { + return new DeployGateSdkConfiguration(); + } + } +}