### Question:
SecRuleEntityDecoder { public static Long getEtherType(SecurityRule secRule) { Class<? extends EthertypeBase> ethertype = secRule.getEthertype(); if (ethertype == null) { return null; } if (ethertype.isAssignableFrom(EthertypeV4.class)) { return EtherTypeClassifierDefinition.IPv4_VALUE; } if (ethertype.isAssignableFrom(EthertypeV6.class)) { return EtherTypeClassifierDefinition.IPv6_VALUE; } throw new IllegalArgumentException("Ethertype " + ethertype + " is not supported."); } private  SecRuleEntityDecoder(); static ContractId getContractId(SecurityRule secRule); static ClassifierInstance getClassifierInstance(SecurityRule secRule); static ActionRef createActionRefFromActionChoice(ActionChoice action); static ClassifierRef getClassifierRef(SecurityRule secRule); static Direction getDirection(SecurityRule secRule); static Clause getClause(SecurityRule secRule); static boolean isEtherTypeOfOneWithinTwo(SecurityRule one, SecurityRule two); static boolean isProtocolOfOneWithinTwo(SecurityRule one, SecurityRule two); static boolean isPortsOfOneWithinTwo(SecurityRule one, SecurityRule two); static Long getEtherType(SecurityRule secRule); static Long getProtocol(SecurityRule secRule);  }### Answer:
@Test public final void testGetEtherType_ethertypeIPv4() { secRuleBuilder.setEthertype(EthertypeV4.class); Assert.assertEquals(EtherTypeClassifierDefinition.IPv4_VALUE, SecRuleEntityDecoder.getEtherType(secRuleBuilder.build())); }
@Test public final void testGetEtherType_ethertypeIPv6() { secRuleBuilder.setEthertype(EthertypeV6.class); Assert.assertEquals(EtherTypeClassifierDefinition.IPv6_VALUE, SecRuleEntityDecoder.getEtherType(secRuleBuilder.build())); }
@Test public final void testGetEtherType_ethertypeNull() { secRuleBuilder.setEthertype(null); Assert.assertNull(SecRuleEntityDecoder.getEtherType(secRuleBuilder.build())); }
@Test public final void testGetEtherType_ethertypeUnknown() { secRuleBuilder.setEthertype(UnknownEthertype.class); thrown.expect(IllegalArgumentException.class); SecRuleEntityDecoder.getEtherType(secRuleBuilder.build()); }