1 /* 2 * Copyright (C) 2023 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 android.car.testapi; 18 19 import android.car.media.CarAudioZoneConfigInfo; 20 21 /** 22 * Factory class used to create an instance of {@link android.car.media.CarAudioZoneConfigInfo} 23 * for testing purposes since the constructor is hidden. 24 */ 25 public final class CarAudioZoneConfigInfoTestBuilder { 26 27 private String mName = "name"; 28 private int mZoneId; 29 private int mConfigId; 30 31 /** 32 * Builder used to creates an {@link android.car.media.CarAudioZoneConfigInfo} 33 * object of the desired state, setting name, {@code zoneId}, and {@code configId}. 34 */ CarAudioZoneConfigInfoTestBuilder()35 public CarAudioZoneConfigInfoTestBuilder() { 36 } 37 38 /** Sets the name of the {@link android.car.media.CarAudioZoneConfigInfo} object */ setName(String name)39 public CarAudioZoneConfigInfoTestBuilder setName(String name) { 40 mName = name; 41 return this; 42 } 43 /** 44 * Sets the audio {@code zoneId} of the 45 * {@link android.car.media.CarAudioZoneConfigInfo} object 46 */ setZoneId(int zoneId)47 public CarAudioZoneConfigInfoTestBuilder setZoneId(int zoneId) { 48 mZoneId = zoneId; 49 return this; 50 } 51 /** Sets the {@code configId} of the {@link android.car.media.CarAudioZoneConfigInfo} object */ setConfigId(int configId)52 public CarAudioZoneConfigInfoTestBuilder setConfigId(int configId) { 53 mConfigId = configId; 54 return this; 55 } 56 57 /** 58 * Builds an {@link android.car.media.CarAudioZoneConfigInfo} 59 * object of the desired state, setting name, {@code zoneId}, and {@code configId}. 60 */ build()61 public CarAudioZoneConfigInfo build() { 62 return new CarAudioZoneConfigInfo(mName, mZoneId, mConfigId); 63 } 64 } 65