### Question:
SemverSchemaVersioner implements SchemaVersioner { @VisibleForTesting static String getMajorVersion(final String protoPackage) { final Matcher matcher = MAJOR_VERSION_RE.matcher(protoPackage); if (matcher.matches()) { return matcher.group("major"); } else { return "1"; } } private  SemverSchemaVersioner(); static SemverSchemaVersioner create(); @Override SchemaVersion determineVersion(final String protoPackage,
                                        @Nullable final SchemaVersion currentVersion,
                                        final DescriptorSet current,
                                        final DescriptorSet candidate);  }### Answer:
@Test public void testGetMajorVersion() throws Exception { assertThat(SemverSchemaVersioner.getMajorVersion("herp.derp"), equalTo("1")); assertThat(SemverSchemaVersioner.getMajorVersion("herp.derp.v1"), equalTo("1")); assertThat(SemverSchemaVersioner.getMajorVersion("herp.derp.v3"), equalTo("3")); assertThat(SemverSchemaVersioner.getMajorVersion("herp.derp.v1beta"), equalTo("1beta")); assertThat(SemverSchemaVersioner.getMajorVersion("herp.derp.v1beta2"), equalTo("1beta2")); assertThat(SemverSchemaVersioner.getMajorVersion("herp.derp.v1alpha"), equalTo("1alpha")); assertThat(SemverSchemaVersioner.getMajorVersion("herp.derp.v1alpha3"), equalTo("1alpha3")); assertThat(SemverSchemaVersioner.getMajorVersion("foo.v2.admin.v3"), equalTo("3")); }