Skip to content

Commit

Permalink
More cleanup for 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
isuPatches committed Jul 10, 2017
1 parent 1df8e7b commit 086098c
Show file tree
Hide file tree
Showing 16 changed files with 543 additions and 708 deletions.
2 changes: 0 additions & 2 deletions wisefy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:support-annotations:25.3.1'

androidTestCompile 'com.android.support:support-annotations:25.3.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'org.mockito:mockito-android:2.8.47'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void noCallbacks_failure_nullSSID() {
public void noCallbacks_failure_nullWifiManager() {
setManagersToNull();
int result = mWiseFy.addOpenNetwork(OPEN_NETWORK_SSID);
assertEquals(WiseFyCodes.NULL_MANAGER, result);
assertEquals(WiseFyCodes.MISSING_PREREQUISITE, result);
}

@Test
Expand Down Expand Up @@ -115,15 +115,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
AddOpenNetworkCallbacks mockAddNetworkCallbacks = mock(AddOpenNetworkCallbacks.class);
mWiseFy.addOpenNetwork(OPEN_NETWORK_SSID, mockAddNetworkCallbacks);
verify(mockAddNetworkCallbacks, timeout(3000)).addOpenNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockAddNetworkCallbacks, timeout(3000)).addOpenNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallback() {
setManagersToNull();
AddOpenNetworkCallbacks mockAddNetworkCallbacks = mock(AddOpenNetworkCallbacks.class);
mWiseFy.addOpenNetwork(OPEN_NETWORK_SSID, null);
verify(mockAddNetworkCallbacks, never()).addOpenNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockAddNetworkCallbacks, never()).addOpenNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void noCallbacks_failure_nullSSID() {
public void noCallbacks_failure_nullWifiManager() {
setManagersToNull();
int result = mWiseFy.addWEPNetwork(WEP_NETWORK_SSID, WEP_NETWORK_PASSWORD);
assertEquals(WiseFyCodes.NULL_MANAGER, result);
assertEquals(WiseFyCodes.MISSING_PREREQUISITE, result);
}

@Test
Expand Down Expand Up @@ -133,15 +133,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
AddWEPNetworkCallbacks mockAddNetworkCallbacks = mock(AddWEPNetworkCallbacks.class);
mWiseFy.addWEPNetwork(WEP_NETWORK_SSID, WEP_NETWORK_PASSWORD, mockAddNetworkCallbacks);
verify(mockAddNetworkCallbacks, timeout(2000)).addWEPNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockAddNetworkCallbacks, timeout(2000)).addWEPNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallback() {
setManagersToNull();
AddWEPNetworkCallbacks mockAddNetworkCallbacks = mock(AddWEPNetworkCallbacks.class);
mWiseFy.addWEPNetwork(WEP_NETWORK_SSID, WEP_NETWORK_PASSWORD, null);
verify(mockAddNetworkCallbacks, never()).addWEPNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockAddNetworkCallbacks, never()).addWEPNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void anoCallbacks_failure_nullSSID() {
public void noCallbacks_failure_nullWifiManager() {
setManagersToNull();
int result = mWiseFy.addWPA2Network(WPA2_NETWORK_SSID, WPA2_NETWORK_PASSWORD);
assertEquals(WiseFyCodes.NULL_MANAGER, result);
assertEquals(WiseFyCodes.MISSING_PREREQUISITE, result);
}

@Test
Expand Down Expand Up @@ -132,15 +132,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
AddWPA2NetworkCallbacks mockAddNetworkCallbacks = mock(AddWPA2NetworkCallbacks.class);
mWiseFy.addWPA2Network(WPA2_NETWORK_SSID, WPA2_NETWORK_PASSWORD, mockAddNetworkCallbacks);
verify(mockAddNetworkCallbacks, timeout(2000)).addWPA2NetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockAddNetworkCallbacks, timeout(2000)).addWPA2NetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallback() {
setManagersToNull();
AddWPA2NetworkCallbacks mockAddNetworkCallbacks = mock(AddWPA2NetworkCallbacks.class);
mWiseFy.addWPA2Network(WPA2_NETWORK_SSID, WPA2_NETWORK_PASSWORD, null);
verify(mockAddNetworkCallbacks, never()).addWPA2NetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockAddNetworkCallbacks, never()).addWPA2NetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
ConnectToNetworkCallbacks connectToNetworkCallbacks = mock(ConnectToNetworkCallbacks.class);
mWiseFy.connectToNetwork(TEST_SSID, 1, connectToNetworkCallbacks);
verify(connectToNetworkCallbacks, timeout(2000)).connectToNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(connectToNetworkCallbacks, timeout(2000)).connectToNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallback() {
setManagersToNull();
ConnectToNetworkCallbacks connectToNetworkCallbacks = mock(ConnectToNetworkCallbacks.class);
mWiseFy.connectToNetwork(TEST_SSID, 1, null);
verify(connectToNetworkCallbacks, never()).connectToNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(connectToNetworkCallbacks, never()).connectToNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void callbacks_failure_nullWifiManager() {
DisableWifiCallbacks mockDisableWifiCallbacks = mock(DisableWifiCallbacks.class);
mWiseFy.disableWifi(mockDisableWifiCallbacks);
verify(mMockWiFiManager, never()).setWifiEnabled(false);
verify(mockDisableWifiCallbacks, timeout(2000)).disableWifiWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockDisableWifiCallbacks, timeout(2000)).disableWifiWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand All @@ -81,7 +81,7 @@ public void callbacks_failure_nullWifiManager_nullCallback() {
DisableWifiCallbacks mockDisableWifiCallbacks = mock(DisableWifiCallbacks.class);
mWiseFy.disableWifi(null);
verify(mMockWiFiManager, never()).setWifiEnabled(false);
verify(mockDisableWifiCallbacks, never()).disableWifiWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockDisableWifiCallbacks, never()).disableWifiWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void callbacks_failure_nullWifiManager() {
DisconnectFromCurrentNetworkCallbacks disconnectFromCurrentNetworkCallbacks = mock(DisconnectFromCurrentNetworkCallbacks.class);
mWiseFy.disconnectFromCurrentNetwork(disconnectFromCurrentNetworkCallbacks);
verify(mMockWiFiManager, never()).disconnect();
verify(disconnectFromCurrentNetworkCallbacks, timeout(2000)).disconnectFromCurrentNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(disconnectFromCurrentNetworkCallbacks, timeout(2000)).disconnectFromCurrentNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand All @@ -80,7 +80,7 @@ public void callbacks_failure_nullWifiManager_nullCallback() {
DisconnectFromCurrentNetworkCallbacks disconnectFromCurrentNetworkCallbacks = mock(DisconnectFromCurrentNetworkCallbacks.class);
mWiseFy.disconnectFromCurrentNetwork(null);
verify(mMockWiFiManager, never()).disconnect();
verify(disconnectFromCurrentNetworkCallbacks, never()).disconnectFromCurrentNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(disconnectFromCurrentNetworkCallbacks, never()).disconnectFromCurrentNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void callbacks_failure_nullWifiManager() {
EnableWifiCallbacks enableWifiCallbacks = mock(EnableWifiCallbacks.class);
mWiseFy.enableWifi(enableWifiCallbacks);
verify(mMockWiFiManager, never()).setWifiEnabled(true);
verify(enableWifiCallbacks, timeout(2000)).enableWifiWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(enableWifiCallbacks, timeout(2000)).enableWifiWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand All @@ -81,7 +81,7 @@ public void callbacks_failure_nullWifiManager_nullCallback() {
EnableWifiCallbacks enableWifiCallbacks = mock(EnableWifiCallbacks.class);
mWiseFy.enableWifi(null);
verify(mMockWiFiManager, never()).setWifiEnabled(true);
verify(enableWifiCallbacks, never()).enableWifiWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(enableWifiCallbacks, never()).enableWifiWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
GetCurrentNetworkCallbacks getCurrentNetworkCallbacks = mock(GetCurrentNetworkCallbacks.class);
mWiseFy.getCurrentNetwork(getCurrentNetworkCallbacks);
verify(getCurrentNetworkCallbacks, timeout(2000)).getCurrentNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getCurrentNetworkCallbacks, timeout(2000)).getCurrentNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallbacks() {
setManagersToNull();
GetCurrentNetworkCallbacks getCurrentNetworkCallbacks = mock(GetCurrentNetworkCallbacks.class);
mWiseFy.getCurrentNetwork(null);
verify(getCurrentNetworkCallbacks, never()).getCurrentNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getCurrentNetworkCallbacks, never()).getCurrentNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,30 +294,30 @@ public void callbacks_failure_filterDuplicates_false_nullWifiManager() {
setManagersToNull();
GetNearbyAccessPointsCallbacks getNearbyAccessPointsCallbacks = mock(GetNearbyAccessPointsCallbacks.class);
mWiseFy.getNearbyAccessPoints(false, getNearbyAccessPointsCallbacks);
verify(getNearbyAccessPointsCallbacks, timeout(2000)).getNearbyAccessPointsWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getNearbyAccessPointsCallbacks, timeout(2000)).getNearbyAccessPointsWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_filterDuplicates_false_nullWifiManager_nullCallback() {
setManagersToNull();
GetNearbyAccessPointsCallbacks getNearbyAccessPointsCallbacks = mock(GetNearbyAccessPointsCallbacks.class);
mWiseFy.getNearbyAccessPoints(false, null);
verify(getNearbyAccessPointsCallbacks, never()).getNearbyAccessPointsWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getNearbyAccessPointsCallbacks, never()).getNearbyAccessPointsWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_filterDuplicates_true_nullWifiManager() {
setManagersToNull();
GetNearbyAccessPointsCallbacks getNearbyAccessPointsCallbacks = mock(GetNearbyAccessPointsCallbacks.class);
mWiseFy.getNearbyAccessPoints(true, getNearbyAccessPointsCallbacks);
verify(getNearbyAccessPointsCallbacks, timeout(2000)).getNearbyAccessPointsWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getNearbyAccessPointsCallbacks, timeout(2000)).getNearbyAccessPointsWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_filterDuplicates_true_nullWifiManager_nullCallback() {
setManagersToNull();
GetNearbyAccessPointsCallbacks getNearbyAccessPointsCallbacks = mock(GetNearbyAccessPointsCallbacks.class);
mWiseFy.getNearbyAccessPoints(true, null);
verify(getNearbyAccessPointsCallbacks, never()).getNearbyAccessPointsWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getNearbyAccessPointsCallbacks, never()).getNearbyAccessPointsWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
GetSavedNetworkCallbacks getSavedNetworkCallbacks = mock(GetSavedNetworkCallbacks.class);
mWiseFy.getSavedNetwork(TEST_SSID, getSavedNetworkCallbacks);
verify(getSavedNetworkCallbacks, timeout(2000)).getSavedNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getSavedNetworkCallbacks, timeout(2000)).getSavedNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallback() {
setManagersToNull();
GetSavedNetworkCallbacks getSavedNetworkCallbacks = mock(GetSavedNetworkCallbacks.class);
mWiseFy.getSavedNetwork(TEST_SSID, null);
verify(getSavedNetworkCallbacks, never()).getSavedNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getSavedNetworkCallbacks, never()).getSavedNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
GetSavedNetworksCallbacks getSavedNetworksCallbacks = mock(GetSavedNetworksCallbacks.class);
mWiseFy.getSavedNetworks(getSavedNetworksCallbacks);
verify(getSavedNetworksCallbacks, timeout(2000)).getSavedNetworksWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getSavedNetworksCallbacks, timeout(2000)).getSavedNetworksWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallback() {
setManagersToNull();
GetSavedNetworksCallbacks getSavedNetworksCallbacks = mock(GetSavedNetworksCallbacks.class);
mWiseFy.getSavedNetworks(null);
verify(getSavedNetworksCallbacks, never()).getSavedNetworksWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(getSavedNetworksCallbacks, never()).getSavedNetworksWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
RemoveNetworkCallbacks removeNetworkCallbacks = mock(RemoveNetworkCallbacks.class);
mWiseFy.removeNetwork(TEST_SSID, removeNetworkCallbacks);
verify(removeNetworkCallbacks, timeout(2000)).removeNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(removeNetworkCallbacks, timeout(2000)).removeNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallback() {
setManagersToNull();
RemoveNetworkCallbacks removeNetworkCallbacks = mock(RemoveNetworkCallbacks.class);
mWiseFy.removeNetwork(TEST_SSID, null);
verify(removeNetworkCallbacks, never()).removeNetworkWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(removeNetworkCallbacks, never()).removeNetworkWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ public void callbacks_failure_nullWifiManager() {
setManagersToNull();
SearchForSSIDCallbacks mockSearchForSSIDCallbacks = mock(SearchForSSIDCallbacks.class);
mWiseFy.searchForSSID(TEST_SSID, 1, mockSearchForSSIDCallbacks);
verify(mockSearchForSSIDCallbacks, timeout(2000)).searchForSSIDWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockSearchForSSIDCallbacks, timeout(2000)).searchForSSIDWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
public void callbacks_failure_nullWifiManager_nullCallback() {
setManagersToNull();
SearchForSSIDCallbacks mockSearchForSSIDCallbacks = mock(SearchForSSIDCallbacks.class);
mWiseFy.searchForSSID(TEST_SSID, 1, null);
verify(mockSearchForSSIDCallbacks, never()).searchForSSIDWiseFyFailure(WiseFyCodes.NULL_MANAGER);
verify(mockSearchForSSIDCallbacks, never()).searchForSSIDWiseFyFailure(WiseFyCodes.MISSING_PREREQUISITE);
}

@Test
Expand Down
Loading

0 comments on commit 086098c

Please sign in to comment.