ConnectionManagerSettings extends AbstractSettings { @Override public void resetDefaults() { setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT_IN_MILLISECONDS); setInsecureRfcommSocketPortNumber(SYSTEM_DECIDED_INSECURE_RFCOMM_SOCKET_PORT); setMaxNumberOfConnectionAttemptRetries(DEFAULT_MAX_NUMBER_OF_CONNECTION_ATTEMPT_RETRIES); setHandshakeRequired(DEFAULT_HANDSHAKE_REQUIRED); } private  ConnectionManagerSettings(Context context); private  ConnectionManagerSettings(Context context, SharedPreferences preferences); static ConnectionManagerSettings getInstance(Context context); static ConnectionManagerSettings getInstance(Context context, SharedPreferences preferences); long getConnectionTimeout(); void setConnectionTimeout(long connectionTimeoutInMilliseconds); int getInsecureRfcommSocketPortNumber(); boolean setInsecureRfcommSocketPortNumber(int insecureRfcommSocketPort); int getMaxNumberOfConnectionAttemptRetries(); void setMaxNumberOfConnectionAttemptRetries(int maxNumberOfRetries); boolean getHandshakeRequired(); void setHandshakeRequired(boolean requireHandshake); @Override void load(); @Override void resetDefaults(); static final long DEFAULT_CONNECTION_TIMEOUT_IN_MILLISECONDS; static final int SYSTEM_DECIDED_INSECURE_RFCOMM_SOCKET_PORT; static final int DEFAULT_ALTERNATIVE_INSECURE_RFCOMM_SOCKET_PORT; static final int DEFAULT_MAX_NUMBER_OF_CONNECTION_ATTEMPT_RETRIES; static final boolean DEFAULT_HANDSHAKE_REQUIRED; }
@Test public void testResetDefaults() throws Exception { mConnectionManagerSettings.resetDefaults(); assertThat("Default connection timeout", mConnectionManagerSettings.getConnectionTimeout(), is(equalTo(BluetoothConnector.DEFAULT_CONNECTION_TIMEOUT_IN_MILLISECONDS))); assertThat("Default port number", mConnectionManagerSettings.getInsecureRfcommSocketPortNumber(), is(equalTo(BluetoothConnector.SYSTEM_DECIDED_INSECURE_RFCOMM_SOCKET_PORT))); assertThat("Default max number of connection attempt retries number", mConnectionManagerSettings.getMaxNumberOfConnectionAttemptRetries(), is(equalTo(ConnectionManagerSettings.DEFAULT_MAX_NUMBER_OF_CONNECTION_ATTEMPT_RETRIES))); assertThat("Require a handshake protocol is properly set to default", mConnectionManagerSettings.getHandshakeRequired(), is(BluetoothConnector.DEFAULT_HANDSHAKE_REQUIRED)); }