@Test(expected = IllegalArgumentException.class) public void validatePropRaiseTest() { Switch sw = Switch.builder() .switchId(new SwitchId(1)) .build(); SwitchProperties sp = SwitchProperties.builder() .switchObj(sw) .build(); sp.validateProp(SwitchFeature.BFD); }
@VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s", getSwitchId(), feature); throw new IllegalArgumentException(message); } return true; }
SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s", getSwitchId(), feature); throw new IllegalArgumentException(message); } return true; } }
SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s", getSwitchId(), feature); throw new IllegalArgumentException(message); } return true; } private  SwitchProperties();  SwitchProperties(@NonNull SwitchProperties entityToClone); @Builder  SwitchProperties(Switch switchObj, Set<FlowEncapsulationType> supportedTransitEncapsulation,
                            boolean multiTable, boolean switchLldp, boolean switchArp, boolean server42FlowRtt,
                            Integer server42Port, MacAddress server42MacAddress, Integer server42Vlan,
                            Integer inboundTelescopePort, Integer outboundTelescopePort,
                            Integer telescopeIngressVlan, Integer telescopeEgressVlan);  SwitchProperties(@NonNull SwitchPropertiesData data); }
SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s", getSwitchId(), feature); throw new IllegalArgumentException(message); } return true; } private  SwitchProperties();  SwitchProperties(@NonNull SwitchProperties entityToClone); @Builder  SwitchProperties(Switch switchObj, Set<FlowEncapsulationType> supportedTransitEncapsulation,
                            boolean multiTable, boolean switchLldp, boolean switchArp, boolean server42FlowRtt,
                            Integer server42Port, MacAddress server42MacAddress, Integer server42Vlan,
                            Integer inboundTelescopePort, Integer outboundTelescopePort,
                            Integer telescopeIngressVlan, Integer telescopeEgressVlan);  SwitchProperties(@NonNull SwitchPropertiesData data); void setMultiTable(boolean multiTable); void setSupportedTransitEncapsulation(Set<FlowEncapsulationType> supportedTransitEncapsulation); @VisibleForTesting boolean validateProp(SwitchFeature feature); @Override boolean equals(Object o); @Override int hashCode(); }
SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s", getSwitchId(), feature); throw new IllegalArgumentException(message); } return true; } private  SwitchProperties();  SwitchProperties(@NonNull SwitchProperties entityToClone); @Builder  SwitchProperties(Switch switchObj, Set<FlowEncapsulationType> supportedTransitEncapsulation,
                            boolean multiTable, boolean switchLldp, boolean switchArp, boolean server42FlowRtt,
                            Integer server42Port, MacAddress server42MacAddress, Integer server42Vlan,
                            Integer inboundTelescopePort, Integer outboundTelescopePort,
                            Integer telescopeIngressVlan, Integer telescopeEgressVlan);  SwitchProperties(@NonNull SwitchPropertiesData data); void setMultiTable(boolean multiTable); void setSupportedTransitEncapsulation(Set<FlowEncapsulationType> supportedTransitEncapsulation); @VisibleForTesting boolean validateProp(SwitchFeature feature); @Override boolean equals(Object o); @Override int hashCode(); static Set<FlowEncapsulationType> DEFAULT_FLOW_ENCAPSULATION_TYPES; }