1
0
mirror of https://github.com/google/nomulus synced 2026-01-07 14:05:44 +00:00
Files
nomulus/javatests/com/google/domain/registry/whois/WhoisHelper.java
2016-03-01 17:59:16 -05:00

34 lines
1.3 KiB
Java

// Copyright 2016 Google Inc. 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 com.google.domain.registry.whois;
import static com.google.domain.registry.util.ResourceUtils.readResourceUtf8;
/** Test helper methods for the whois package. */
final class WhoisHelper {
/**
* Loads test data from file in {@code testdata/} directory, "fixing" newlines to have the ending
* that WHOIS requires and appending the disclaimer text.
*/
static String loadWhoisTestFile(String filename) {
return new StringBuilder(readResourceUtf8(WhoisHelper.class, "testdata/" + filename))
.append('\n')
.append(readResourceUtf8(WhoisServer.class, "disclaimer.txt"))
.toString()
.replaceAll("\r?\n", "\r\n");
}
}