1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.adservices.service.stats; 18 19 import static org.junit.Assert.assertEquals; 20 21 import android.adservices.common.AdServicesStatusUtils; 22 23 import org.junit.Test; 24 25 /** Unit tests for {@link UpdateCustomAudienceProcessReportedStats}. */ 26 public class UpdateCustomAudienceProcessReportedStatsTest { 27 static final int LATENCY_IN_MILLIS = 10; 28 static final int RESULT_CODE = AdServicesStatusUtils.STATUS_SUCCESS; 29 static final int DATA_SIZE_OF_ADS_IN_BYTES = 10; 30 static final int NUM_OF_ADS = 5; 31 32 @Test testBuilderCreateSuccess()33 public void testBuilderCreateSuccess() { 34 UpdateCustomAudienceProcessReportedStats stats = 35 UpdateCustomAudienceProcessReportedStats.builder() 36 .setLatencyInMills(LATENCY_IN_MILLIS) 37 .setResultCode(RESULT_CODE) 38 .setDataSizeOfAdsInBytes(DATA_SIZE_OF_ADS_IN_BYTES) 39 .setNumOfAds(NUM_OF_ADS) 40 .build(); 41 assertEquals(LATENCY_IN_MILLIS, stats.getLatencyInMills()); 42 assertEquals(RESULT_CODE, stats.getResultCode()); 43 assertEquals(DATA_SIZE_OF_ADS_IN_BYTES, stats.getDataSizeOfAdsInBytes()); 44 assertEquals(NUM_OF_ADS, stats.getNumOfAds()); 45 } 46 } 47