### Question:
SecRuleEntityDecoder { public static Direction getDirection(SecurityRule secRule) { Class<? extends DirectionBase> direction = secRule.getDirection(); if (direction == null) { throw new IllegalArgumentException("Direction cannot be null."); } if (direction.isAssignableFrom(DirectionIngress.class)) { return Direction.In; } if (direction.isAssignableFrom(DirectionEgress.class)) { return Direction.Out; } throw new IllegalArgumentException("Direction " + direction + " from security group rule " + secRule + " is not supported. Direction can be only 'ingress' or 'egress'."); } 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 testGetDirection_directionIngress() { secRuleBuilder.setDirection(DirectionIngress.class); Assert.assertEquals(Direction.In, SecRuleEntityDecoder.getDirection(secRuleBuilder.build())); }
@Test public final void testGetDirection_directionEgress() { secRuleBuilder.setDirection(DirectionEgress.class); Assert.assertEquals(Direction.Out, SecRuleEntityDecoder.getDirection(secRuleBuilder.build())); }
@Test public final void testGetDirection_directionNull() { secRuleBuilder.setDirection(null); thrown.expect(IllegalArgumentException.class); SecRuleEntityDecoder.getDirection(secRuleBuilder.build()); }
@Test public final void testGetDirection_directionUnknown() { secRuleBuilder.setDirection(UnknownDirection.class); thrown.expect(IllegalArgumentException.class); SecRuleEntityDecoder.getDirection(secRuleBuilder.build()); }