Skip to content

Commit

Permalink
fix: Add SdkConfiguration class and install method to DeployGate in mock
Browse files Browse the repository at this point in the history
test: Add a new testcase that uses these entities
  • Loading branch information
jmatsu committed Mar 22, 2024
1 parent 89d8676 commit 90fd09d
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
36 changes: 36 additions & 0 deletions sdk/src/test/java/com/deploygate/sdk/DeployGateInterfaceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions sdkMock/src/main/java/com/deploygate/sdk/DeployGate.java
Original file line number Diff line number Diff line change
@@ -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) {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
}

0 comments on commit 90fd09d

Please sign in to comment.