### Question:
Subnet { public static String extractVirtualNetwork(String id) { if (id == null) return null; Matcher m = NETWORK_PATTERN.matcher(id); m.matches(); return m.group(1); } Subnet(); @Nullable abstract String name(); @Nullable abstract String id(); @Nullable abstract String etag(); @Nullable abstract SubnetProperties properties(); @Nullable String virtualNetwork(); static String extractVirtualNetwork(String id); @SerializedNames({"name", "id", "etag", "properties"}) static Subnet create(final String name,
                               final String id,
                               final String etag,
                               final SubnetProperties properties); abstract Builder toBuilder(); static Builder builder(); static final String GATEWAY_SUBNET_NAME; }### Answer:
@Test public void testExtractVirtualNetwork() { assertEquals(Subnet.builder().build().virtualNetwork(), null); assertEquals( Subnet.builder() .id("/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vn/subnets/subnet") .build().virtualNetwork(), "vn"); assertInvalidId("/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks"); assertInvalidId("virtualNetworks/vn"); }