@@ -0,0 +1,1781 @@
+// Copyright 2017 The Nomulus Authors. All Rights Reserved.%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A//     http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0A%0Apackage google.registry.dns.writer;%0A%0Aimport static com.google.common.truth.Truth.assertThat;%0Aimport static google.registry.testing.JUnitBackports.assertThrows;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.JUnit4;%0A%0A/** Unit tests for %7B@link BaseDnsWriter%7D. */%0A@RunWith(JUnit4.class)%0Apublic class BaseDnsWriterTest %7B%0A%0A  static class StubDnsWriter extends BaseDnsWriter %7B%0A%0A    int commitCallCount = 0;%0A%0A    @Override%0A    protected void commitUnchecked() %7B%0A      commitCallCount++;%0A    %7D%0A%0A    @Override%0A    public void publishDomain(String domainName) %7B%0A      // No op%0A    %7D%0A%0A    @Override%0A    public void publishHost(String hostName) %7B%0A      // No op%0A    %7D%0A  %7D%0A%0A  @Test%0A  public void test_cannotBeCalledTwice() %7B%0A    StubDnsWriter writer = new StubDnsWriter();%0A    assertThat(writer.commitCallCount).isEqualTo(0);%0A    writer.commit();%0A    assertThat(writer.commitCallCount).isEqualTo(1);%0A    IllegalStateException thrown = assertThrows(IllegalStateException.class, writer::commit);%0A    assertThat(thrown).hasMessageThat().isEqualTo(%22commit() has already been called%22);%0A    assertThat(writer.commitCallCount).isEqualTo(1);%0A  %7D%0A%7D%0A

Add BaseDnsWriterTest to opensource tree