Skip to content
Snippets Groups Projects
Commit af095458 authored by ttschol's avatar ttschol
Browse files

Use lowercase for searchDevice in getFilteredDevices

parent 34783ff5
No related branches found
No related tags found
No related merge requests found
Pipeline #41579 passed
......@@ -34,9 +34,11 @@ public final class TinybUtil {
Preconditions.checkNotNull(manager, "Precondition violation - argument 'manager' must not be NULL!");
Preconditions.checkNotNull(searchDevice, "Precondition violation - argument 'searchDevice' must not be NULL!");
final String searchDeviceLowercase = searchDevice.toLowerCase(Locale.ROOT);
List<BluetoothDevice> devices = new ArrayList<>();
for (BluetoothDevice device : manager.getDevices()) {
if (device.getName().toLowerCase(Locale.ROOT).contains(searchDevice)) {
if (device.getName().toLowerCase(Locale.ROOT).contains(searchDeviceLowercase)) {
final int rssi = device.getRSSI();
if (rssi == 0) {
System.out.println(searchDevice + " with address " + device.getAddress() + " has no signal.");
......
......@@ -20,7 +20,7 @@ public class TinybUtilTest {
List<BluetoothDevice> mockDevices = utilMockDevices();
when(bluetoothManager.getDevices()).thenReturn(mockDevices);
List<BluetoothDevice> devices = TinybUtil.getFilteredDevices(bluetoothManager, "timeflip");
List<BluetoothDevice> devices = TinybUtil.getFilteredDevices(bluetoothManager, "TimeFlip");
Assert.assertNotNull(devices);
Assert.assertEquals(2, devices.size());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment