### Question:
IotCoreClient { public boolean publishTelemetry(@NonNull TelemetryEvent event) { synchronized (mQueueLock) { int preOfferSize = mTelemetryQueue.size(); if (!mTelemetryQueue.offer(event) || mTelemetryQueue.size() == preOfferSize) { return false; } } mSemaphore.release(); return true; } private  IotCoreClient(
            @NonNull ConnectionParams connectionParams,
            @NonNull KeyPair keyPair,
            @NonNull MqttClient mqttClient,
            @NonNull Queue<TelemetryEvent> telemetryQueue,
            @Nullable Executor connectionCallbackExecutor,
            @Nullable ConnectionCallback connectionCallback,
            @Nullable Executor onConfigurationExecutor,
            @Nullable OnConfigurationListener onConfigurationListener,
            @Nullable Executor onCommandExecutor,
            @Nullable OnCommandListener onCommandListener); @VisibleForTesting  IotCoreClient(
            @NonNull ConnectionParams configuration,
            @NonNull MqttClient mqttClient,
            @NonNull JwtGenerator jwtGenerator,
            @NonNull AtomicBoolean runBackgroundThread,
            @NonNull AtomicReference<byte[]> unsentDeviceState,
            @NonNull Queue<TelemetryEvent> telemetryQueue,
            @Nullable Executor connectionCallbackExecutor,
            @Nullable ConnectionCallback connectionCallback,
            @Nullable Executor onConfigurationExecutor,
            @Nullable OnConfigurationListener onConfigurationListener,
            @Nullable Executor onCommandExecutor,
            @Nullable OnCommandListener onCommandListener,
            @NonNull Semaphore semaphore,
            @NonNull BoundedExponentialBackoff backoff,
            @NonNull AtomicBoolean clientConnectionState); void connect(); boolean isConnected(); void disconnect(); boolean publishTelemetry(@NonNull TelemetryEvent event); void publishDeviceState(byte[] state);  }### Answer:
@Test public void testPublishTelemetryEmptyQueue() { when(mMockTelemetryQueue.offer(mMockTelemetryEvent)).thenReturn(true); when(mMockTelemetryQueue.size()).thenReturn(0).thenReturn(1); assertThat(mTestIotCoreClient.publishTelemetry(mMockTelemetryEvent)).isTrue(); verify(mMockSemaphore).release(); }
@Test public void testPublishTelemetryFullQueue() { when(mMockTelemetryQueue.offer(mMockTelemetryEvent)).thenReturn(false); when(mMockTelemetryQueue.size()).thenReturn(1); assertThat(mTestIotCoreClient.publishTelemetry(mMockTelemetryEvent)).isFalse(); verify(mMockSemaphore, never()).release(); }