From ee6c5ce239f378e5b285f4b07288d610c7868ae2 Mon Sep 17 00:00:00 2001 From: Ephraim Kigamba Date: Thu, 13 Jun 2019 18:57:44 +0300 Subject: [PATCH] Fix codacy issues --- .../activity/P2pModeSelectActivityTest.java | 47 ------------------- .../sync/handler/SyncSenderHandlerTest.java | 1 - .../p2p/util/SyncDataConverterUtilTest.java | 5 +- 3 files changed, 2 insertions(+), 51 deletions(-) diff --git a/p2p-sync/src/test/java/org/smartregister/p2p/activity/P2pModeSelectActivityTest.java b/p2p-sync/src/test/java/org/smartregister/p2p/activity/P2pModeSelectActivityTest.java index 0400dd6..93be702 100644 --- a/p2p-sync/src/test/java/org/smartregister/p2p/activity/P2pModeSelectActivityTest.java +++ b/p2p-sync/src/test/java/org/smartregister/p2p/activity/P2pModeSelectActivityTest.java @@ -2,7 +2,6 @@ import android.Manifest; import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; import org.junit.Before; import org.junit.Rule; @@ -21,16 +20,11 @@ import org.smartregister.p2p.TestApplication; import org.smartregister.p2p.authorizer.P2PAuthorizationService; import org.smartregister.p2p.contract.P2pModeSelectContract; -import org.smartregister.p2p.dialog.ConnectingDialog; -import org.smartregister.p2p.dialog.SkipQRScanDialog; -import org.smartregister.p2p.dialog.StartDiscoveringModeProgressDialog; -import org.smartregister.p2p.dialog.StartReceiveModeProgressDialog; import org.smartregister.p2p.handler.OnActivityRequestPermissionHandler; import org.smartregister.p2p.model.DataType; import org.smartregister.p2p.model.dao.ReceiverTransferDao; import org.smartregister.p2p.model.dao.SenderTransferDao; import org.smartregister.p2p.shadows.ShadowAppDatabase; -import org.smartregister.p2p.util.Constants; import java.util.ArrayList; import java.util.List; @@ -259,45 +253,4 @@ public void onStopShouldCallPresenterOnStopMethods() { .onStop(); } - /* @Test - public void showSkipQRScanDialog() { - activity.showSkipQRScanDialog("peer device status" - , "SAMSUNG" - , Mockito.mock(SkipQRScanDialog.SkipDialogCallback.class)); - - DialogFragment dialogFragment = (DialogFragment) activity.getSupportFragmentManager() - .findFragmentByTag(Constants.Dialog.SKIP_QR_SCAN); - - assertTrue(dialogFragment instanceof SkipQRScanDialog); - } - - @Test - public void showConnectingDialog() { - activity.showConnectingDialog(Mockito.mock(P2pModeSelectContract.View.DialogCancelCallback.class)); - - DialogFragment dialogFragment = (DialogFragment) activity.getSupportFragmentManager() - .findFragmentByTag(Constants.Dialog.CONNECTING); - - assertTrue(dialogFragment instanceof ConnectingDialog); - } - - @Test - public void showDiscoveringProgressDialog() { - activity.showDiscoveringProgressDialog(Mockito.mock(P2pModeSelectContract.View.DialogCancelCallback.class)); - - DialogFragment dialogFragment = (DialogFragment) activity.getSupportFragmentManager() - .findFragmentByTag(Constants.Dialog.START_SEND_MODE_PROGRESS); - - assertTrue(dialogFragment instanceof StartDiscoveringModeProgressDialog); - } - - @Test - public void showAdvertisingProgressDialog() { - activity.showAdvertisingProgressDialog(Mockito.mock(P2pModeSelectContract.View.DialogCancelCallback.class)); - - DialogFragment dialogFragment = (DialogFragment) activity.getSupportFragmentManager() - .findFragmentByTag(Constants.Dialog.START_RECEIVE_MODE_PROGRESS); - - assertTrue(dialogFragment instanceof StartReceiveModeProgressDialog); - }*/ } \ No newline at end of file diff --git a/p2p-sync/src/test/java/org/smartregister/p2p/sync/handler/SyncSenderHandlerTest.java b/p2p-sync/src/test/java/org/smartregister/p2p/sync/handler/SyncSenderHandlerTest.java index e70c0df..7e33455 100644 --- a/p2p-sync/src/test/java/org/smartregister/p2p/sync/handler/SyncSenderHandlerTest.java +++ b/p2p-sync/src/test/java/org/smartregister/p2p/sync/handler/SyncSenderHandlerTest.java @@ -2,7 +2,6 @@ import com.google.android.gms.nearby.connection.Payload; import com.google.android.gms.nearby.connection.PayloadTransferUpdate; -import com.google.gson.JsonArray; import org.json.JSONArray; import org.junit.Before; diff --git a/p2p-sync/src/test/java/org/smartregister/p2p/util/SyncDataConverterUtilTest.java b/p2p-sync/src/test/java/org/smartregister/p2p/util/SyncDataConverterUtilTest.java index 6c08a5c..cb56e09 100644 --- a/p2p-sync/src/test/java/org/smartregister/p2p/util/SyncDataConverterUtilTest.java +++ b/p2p-sync/src/test/java/org/smartregister/p2p/util/SyncDataConverterUtilTest.java @@ -1,5 +1,6 @@ package org.smartregister.p2p.util; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -7,8 +8,6 @@ import java.util.HashMap; -import static org.junit.Assert.*; - /** * Created by Ephraim Kigamba - ekigamba@ona.io on 2019-06-12 */ @@ -24,6 +23,6 @@ public void generateSummaryReportShouldReturnNumberFormattedStringWithCorrectVer transferItems.put("oranges", 1023); String actual = SyncDataConverterUtil.generateSummaryReport(RuntimeEnvironment.application, false, transferItems); - assertEquals("1,079 records received", actual); + Assert.assertEquals("1,079 records received", actual); } } \ No newline at end of file