|
| 1 | +/* |
| 2 | + * Copyright 2020 Google LLC |
| 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.google.firebase.remoteconfig; |
| 18 | + |
| 19 | +import static org.junit.Assert.assertEquals; |
| 20 | +import static org.junit.Assert.assertNotEquals; |
| 21 | + |
| 22 | +import org.junit.Test; |
| 23 | + |
| 24 | +public class ParameterValueTest { |
| 25 | + |
| 26 | + @Test |
| 27 | + public void testCreateExplicitValue() { |
| 28 | + final ParameterValue.Explicit parameterValue = ParameterValue.of("title text"); |
| 29 | + |
| 30 | + assertEquals("title text", parameterValue.getValue()); |
| 31 | + } |
| 32 | + |
| 33 | + @Test |
| 34 | + public void testCreateInAppDefault() { |
| 35 | + final ParameterValue.InAppDefault parameterValue = ParameterValue.inAppDefault(); |
| 36 | + |
| 37 | + assertEquals(ParameterValue.InAppDefault.class, parameterValue.getClass()); |
| 38 | + } |
| 39 | + |
| 40 | + @Test |
| 41 | + public void testEquality() { |
| 42 | + ParameterValue.Explicit parameterValueOne = ParameterValue.of("value"); |
| 43 | + ParameterValue.Explicit parameterValueTwo = ParameterValue.of("value"); |
| 44 | + ParameterValue.Explicit parameterValueThree = ParameterValue.of("title"); |
| 45 | + |
| 46 | + assertEquals(parameterValueOne, parameterValueTwo); |
| 47 | + assertNotEquals(parameterValueOne, parameterValueThree); |
| 48 | + |
| 49 | + ParameterValue.InAppDefault parameterValueFour = ParameterValue.inAppDefault(); |
| 50 | + ParameterValue.InAppDefault parameterValueFive = ParameterValue.inAppDefault(); |
| 51 | + |
| 52 | + assertEquals(parameterValueFour, parameterValueFive); |
| 53 | + } |
| 54 | +} |
0 commit comments