Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a77b24a authored by Ömer Faruk Yılmaz's avatar Ömer Faruk Yılmaz Committed by Automerger Merge Worker
Browse files

Merge changes I0e53e6ef,I7beb8b48 am: 1c808a19 am: 58c5edfd am: e9274e93

parents 321930a6 e9274e93
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -20,9 +20,7 @@ package com.android.bluetooth.gatt;
 * These are held during congestion and reported when congestion clears.
 * @hide
 */
/*package*/

class CallbackInfo {
/* package */ class CallbackInfo {
    public String address;
    public int status;
    public int handle;
@@ -58,6 +56,6 @@ class CallbackInfo {
        this.address = address;
        this.status = status;
        this.handle = handle;
        this.value = value;
    }
}
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.bluetooth.gatt;

import static com.google.common.truth.Truth.assertThat;

import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Arrays;

/**
 * Test cases for {@link CallbackInfo}.
 */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class CallbackInfoTest {

    @Test
    public void callbackInfoBuilder() {
        String address = "TestAddress";
        int status = 0;
        int handle = 1;
        byte[] value = "Test Value Byte Array".getBytes();

        CallbackInfo callbackInfo = new CallbackInfo.Builder(address, status)
                .setHandle(handle)
                .setValue(value)
                .build();

        assertThat(callbackInfo.address).isEqualTo(address);
        assertThat(callbackInfo.status).isEqualTo(status);
        assertThat(callbackInfo.handle).isEqualTo(handle);
        assertThat(Arrays.equals(callbackInfo.value, value)).isTrue();
    }
}