@Test public void testOnPeerExpirationTimeChanged_expTimeSetToZero() throws Exception { Field mCheckExpiredPeersTimerField = mPeerModel.getClass().getDeclaredField("mCheckExpiredPeersTimer"); mCheckExpiredPeersTimerField.setAccessible(true); mCheckExpiredPeersTimerField.set(mPeerModel, mMockCheckExpiredPeersTimer); mPeerModel.onPeerExpirationTimeChanged(); verify(mMockCheckExpiredPeersTimer, times(1)) .cancel(); assertThat("The timer for checking for expired peers is stopped", mCheckExpiredPeersTimerField.get(mPeerModel), is(nullValue())); }
public void onPeerExpirationTimeChanged() { if (mCheckExpiredPeersTimer != null) { createCheckPeerExpirationTimer(); } }
PeerModel { public void onPeerExpirationTimeChanged() { if (mCheckExpiredPeersTimer != null) { createCheckPeerExpirationTimer(); } } }
PeerModel { public void onPeerExpirationTimeChanged() { if (mCheckExpiredPeersTimer != null) { createCheckPeerExpirationTimer(); } } PeerModel(Listener listener, DiscoveryManagerSettings settings); }
PeerModel { public void onPeerExpirationTimeChanged() { if (mCheckExpiredPeersTimer != null) { createCheckPeerExpirationTimer(); } } PeerModel(Listener listener, DiscoveryManagerSettings settings); void addListener(Listener listener); void removeListener(Listener listener); void clear(); void onPeerExpirationTimeChanged(); synchronized PeerProperties getDiscoveredPeerByBluetoothMacAddress(final String bluetoothMacAddress); synchronized PeerProperties getDiscoveredPeerByDeviceAddress(final String deviceAddress); synchronized PeerProperties removePeer(PeerProperties peerPropertiesToRemove); void addOrUpdateDiscoveredPeer(PeerProperties peerPropertiesToAddOrUpdate); synchronized void checkListForExpiredPeers(); }
PeerModel { public void onPeerExpirationTimeChanged() { if (mCheckExpiredPeersTimer != null) { createCheckPeerExpirationTimer(); } } PeerModel(Listener listener, DiscoveryManagerSettings settings); void addListener(Listener listener); void removeListener(Listener listener); void clear(); void onPeerExpirationTimeChanged(); synchronized PeerProperties getDiscoveredPeerByBluetoothMacAddress(final String bluetoothMacAddress); synchronized PeerProperties getDiscoveredPeerByDeviceAddress(final String deviceAddress); synchronized PeerProperties removePeer(PeerProperties peerPropertiesToRemove); void addOrUpdateDiscoveredPeer(PeerProperties peerPropertiesToAddOrUpdate); synchronized void checkListForExpiredPeers();  }