Add entity for reserved list (#381)

This PR added the Cloud SQL entity for reserved list.
This commit is contained in:
Shicong Huang 2019-11-26 16:51:41 -05:00 committed by GitHub
parent 28499d23a0
commit 9be5091c84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 340 additions and 0 deletions

View file

@ -0,0 +1,53 @@
// Copyright 2019 The Nomulus Authors. All Rights Reserved.
//
// 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 google.registry.schema.tld;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.ImmutableMap;
import google.registry.model.registry.label.ReservationType;
import google.registry.schema.tld.ReservedList.ReservedEntry;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link ReservedList} */
@RunWith(JUnit4.class)
public class ReservedListTest {
@Test
public void verifyConstructorAndGetters_workCorrectly() {
ReservedList reservedList =
ReservedList.create(
"app",
false,
ImmutableMap.of(
"book",
ReservedEntry.create(ReservationType.ALLOWED_IN_SUNRISE, null),
"music",
ReservedEntry.create(
ReservationType.RESERVED_FOR_ANCHOR_TENANT, "reserved for anchor tenant")));
assertThat(reservedList.getName()).isEqualTo("app");
assertThat(reservedList.getShouldPublish()).isFalse();
assertThat(reservedList.getLabelsToReservations())
.containsExactly(
"book",
ReservedEntry.create(ReservationType.ALLOWED_IN_SUNRISE, null),
"music",
ReservedEntry.create(
ReservationType.RESERVED_FOR_ANCHOR_TENANT, "reserved for anchor tenant"));
}
}