mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 06:44:51 +02:00
Add golden files for request component routing maps
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=157026188
This commit is contained in:
parent
bb67841884
commit
ddb0f5692e
23 changed files with 514 additions and 39 deletions
|
@ -14,11 +14,10 @@
|
|||
|
||||
package google.registry.model;
|
||||
|
||||
import static com.google.common.truth.Truth.assert_;
|
||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||
import static com.google.common.io.Resources.getResource;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import google.registry.testing.GoldenFileTestHelper;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -32,28 +31,15 @@ import org.junit.runners.JUnit4;
|
|||
@RunWith(JUnit4.class)
|
||||
public class SchemaVersionTest {
|
||||
|
||||
private static final String GOLDEN_SCHEMA_FILE = "schema.txt";
|
||||
|
||||
private static final String UPDATE_COMMAND =
|
||||
"google.registry.tools.RegistryTool -e localhost get_schema "
|
||||
+ ">javatests/google/registry/model/schema.txt";
|
||||
|
||||
private static final String UPDATE_INSTRUCTIONS = Joiner.on('\n').join(
|
||||
"",
|
||||
"-------------------------------------------------------------------------------",
|
||||
"Your changes affect the Datastore schema. To update the checked-in schema, run:",
|
||||
UPDATE_COMMAND,
|
||||
"");
|
||||
|
||||
@Rule
|
||||
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
||||
|
||||
@Test
|
||||
public void testGoldenSchemaFile() throws Exception {
|
||||
// Don't use Truth's isEqualTo() because the output is huge and unreadable for large files.
|
||||
if (!(SchemaVersion.getSchema()
|
||||
.equals(readResourceUtf8(SchemaVersionTest.class, GOLDEN_SCHEMA_FILE).trim()))) {
|
||||
assert_().fail(UPDATE_INSTRUCTIONS);
|
||||
}
|
||||
GoldenFileTestHelper.testGoldenFile(
|
||||
SchemaVersion.getSchema(),
|
||||
getResource(SchemaVersionTest.class, "schema.txt"),
|
||||
"Datastore schema",
|
||||
"get_schema");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue