/** Test of getBondedDevices method. Checks name of second bonded device. */ @Test public void testSecondBondedDevice() { System.out.println("SecondBondedDevice"); /* Get the adapter */ BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); /* Get the device list */ Set<BluetoothDevice> deviceSet = mBluetoothAdapter.getBondedDevices(); /* Search for the first known device */ for (BluetoothDevice d : deviceSet) { if (d.getName().equals("DEVICE_NAME_TWO")) { assert (d.getAddress().equals("66:77:88:99:AA:BB")); } } }
/** Test of getBondedDevices method. Checks name of first bonded device. */ @Test public void testFirstBondedDevice() { System.out.println("FirstBondedDevice"); /* Get the adapter */ BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); /* Get the device list */ Set<BluetoothDevice> deviceSet = mBluetoothAdapter.getBondedDevices(); /* Search for the first known device */ for (BluetoothDevice d : deviceSet) { if (d.getName().equals("DEVICE_NAME_ONE")) { assert (d.getAddress().equals("00:11:22:33:44:55")); } } }