diff --git a/src/main/java/org/openepics/names/service/LogService.java b/src/main/java/org/openepics/names/service/LogService.java index ebcc9c43397a048b6876a4494f749b0e6d625ff6..f5a70e858ca8c72b260b10e1196562a428d165a3 100644 --- a/src/main/java/org/openepics/names/service/LogService.java +++ b/src/main/java/org/openepics/names/service/LogService.java @@ -23,6 +23,7 @@ import java.util.logging.Logger; import org.apache.commons.lang3.StringUtils; import org.openepics.names.exception.ServiceException; +import org.openepics.names.util.ValidateUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -60,7 +61,7 @@ public class LogService { * @param e service exception */ public void logServiceException(Logger logger, Level level, ServiceException e) { - if (logger == null || level == null || e == null) { + if (ValidateUtil.isAnyNull(logger, level, e)) { return; } @@ -111,7 +112,7 @@ public class LogService { * @param filterExclude filter exclude */ public void logStackTraceElements(Logger logger, Level level, ServiceException e, int maxNumberOfLogs, String filterInclude, String filterExclude) { - if (logger == null || level == null || e == null || maxNumberOfLogs <= 0) { + if (ValidateUtil.isAnyNull(logger, level, e) || maxNumberOfLogs <= 0) { return; } @@ -130,7 +131,7 @@ public class LogService { * @param filterExclude filter exclude */ public void logStackTraceElements(Logger logger, Level level, Exception e, int maxNumberOfLogs, String filterInclude, String filterExclude) { - if (logger == null || level == null || e == null || maxNumberOfLogs <= 0) { + if (ValidateUtil.isAnyNull(logger, level, e) || maxNumberOfLogs <= 0) { return; } @@ -148,7 +149,7 @@ public class LogService { * @param filterExclude filter exclude */ private void logStackTraceElements(Logger logger, Level level, StackTraceElement[] stackTraceElements, int maxNumberOfLogs, String filterInclude, String filterExclude) { - if (logger == null || level == null || stackTraceElements == null || maxNumberOfLogs <= 0) { + if (ValidateUtil.isAnyNull(logger, level, stackTraceElements) || maxNumberOfLogs <= 0) { return; } diff --git a/src/main/java/org/openepics/names/util/StructureUtil.java b/src/main/java/org/openepics/names/util/StructureUtil.java index fc0c2c46a39bb123a4a39046a024ab6cc99aa4bd..d79cd5b23aa10ed338c0e71aa411be17c869844c 100644 --- a/src/main/java/org/openepics/names/util/StructureUtil.java +++ b/src/main/java/org/openepics/names/util/StructureUtil.java @@ -55,7 +55,7 @@ public class StructureUtil { * @return mnemonic path */ public static String getMnemonicPath(SystemGroup systemGroup, HolderSystemDeviceStructure holderSystemDeviceStructure) { - if (systemGroup == null || holderSystemDeviceStructure == null) { + if (ValidateUtil.isAnyNull(systemGroup, holderSystemDeviceStructure)) { return null; } @@ -72,7 +72,7 @@ public class StructureUtil { * @return mnemonic path */ public static String getMnemonicPath(System system, HolderSystemDeviceStructure holderSystemDeviceStructure) { - if (system == null || holderSystemDeviceStructure == null) { + if (ValidateUtil.isAnyNull(system, holderSystemDeviceStructure)) { return null; } @@ -87,7 +87,7 @@ public class StructureUtil { * @return mnemonic path */ public static String getMnemonicPath(Subsystem subsystem, HolderSystemDeviceStructure holderSystemDeviceStructure) { - if (subsystem == null || holderSystemDeviceStructure == null) { + if (ValidateUtil.isAnyNull(subsystem, holderSystemDeviceStructure)) { return null; } @@ -105,7 +105,7 @@ public class StructureUtil { * @return mnemonic path */ public static String getMnemonicPath(Discipline discipline, HolderSystemDeviceStructure holderSystemDeviceStructure) { - if (discipline == null || holderSystemDeviceStructure == null) { + if (ValidateUtil.isAnyNull(discipline, holderSystemDeviceStructure)) { return null; } @@ -120,7 +120,7 @@ public class StructureUtil { * @return mnemonic path */ public static String getMnemonicPath(DeviceGroup deviceGroup, HolderSystemDeviceStructure holderSystemDeviceStructure) { - if (deviceGroup == null || holderSystemDeviceStructure == null) { + if (ValidateUtil.isAnyNull(deviceGroup, holderSystemDeviceStructure)) { return null; } @@ -138,7 +138,7 @@ public class StructureUtil { * @return mnemonic path */ public static String getMnemonicPath(DeviceType deviceType, HolderSystemDeviceStructure holderSystemDeviceStructure) { - if (deviceType == null || holderSystemDeviceStructure == null) { + if (ValidateUtil.isAnyNull(deviceType, holderSystemDeviceStructure)) { return null; } diff --git a/src/main/java/org/openepics/names/util/ValidateNameElementUtil.java b/src/main/java/org/openepics/names/util/ValidateNameElementUtil.java index 15b07110313af01884cdf59fecaf9267b556a2f2..552651a8abadae240d4fbd5d4240f9e9eaf764f7 100644 --- a/src/main/java/org/openepics/names/util/ValidateNameElementUtil.java +++ b/src/main/java/org/openepics/names/util/ValidateNameElementUtil.java @@ -133,7 +133,7 @@ public class ValidateNameElementUtil { // description // comment - if (nameElement == null || nameChoice == null) { + if (ValidateUtil.isAnyNull(nameElement, nameChoice)) { return; } @@ -237,7 +237,7 @@ public class ValidateNameElementUtil { // ( - system structure uuid, device structure uuid ) // - system structure uuid, device structure uuid, index - if (nameElement == null || namingConvention == null || holderIRepositories == null || nameRepository == null || holder == null || nameChoice == null) { + if (ValidateUtil.isAnyNull(nameElement, namingConvention, holderIRepositories, nameRepository, holder, nameChoice)) { return; } @@ -360,7 +360,7 @@ public class ValidateNameElementUtil { * @see ValidateUtil#validateNameDataCreate(NameElement, EssNamingConvention, HolderIRepositories, NameRepository, HolderSystemDeviceStructure) */ public static void validateNameDataCreate(String name, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { - if (name == null || namingConvention == null || holderRepositories == null || holder == null) { + if (ValidateUtil.isAnyNull(name, namingConvention, holderRepositories, holder)) { return; } diff --git a/src/main/java/org/openepics/names/util/ValidateStructureElementUtil.java b/src/main/java/org/openepics/names/util/ValidateStructureElementUtil.java index 3c2193e94f734087160c1cedcedb5bf50685c18f..0c7b5bb0ead7e83b8612596a3d56f1f9a2627f52 100644 --- a/src/main/java/org/openepics/names/util/ValidateStructureElementUtil.java +++ b/src/main/java/org/openepics/names/util/ValidateStructureElementUtil.java @@ -166,7 +166,7 @@ public class ValidateStructureElementUtil { // description - required // comment - required - if (structureElement == null || structureChoice == null) { + if (ValidateUtil.isAnyNull(structureElement, structureChoice)) { return; } @@ -190,10 +190,7 @@ public class ValidateStructureElementUtil { ValidateUtil.validateInputType(type); if (!StructureChoice.DELETE.equals(structureChoice)) { - if (Type.SYSTEM.equals(type) - || Type.SUBSYSTEM.equals(type) - || Type.DEVICEGROUP.equals(type) - || Type.DEVICETYPE.equals(type)) { + if (ValidateUtil.isAnyEqual(type, Type.SYSTEM, Type.SUBSYSTEM, Type.DEVICEGROUP, Type.DEVICETYPE)) { ExceptionUtil.validateConditionInputNotAvailableException(parentUuid != null, TextUtil.PARENT_IS_NOT_AVAILABLE, structureElement.toString(), TextUtil.PARENT); ValidateUtil.validateInputUuid(parentUuid.toString()); @@ -312,7 +309,7 @@ public class ValidateStructureElementUtil { // approve, reject, cancel // uuid - pending, latest, not deleted - list size 1 - if (structureElement == null || namingConvention == null || holderRepositories == null || holder == null || structureChoice == null) { + if (ValidateUtil.isAnyNull(structureElement, namingConvention, holderRepositories, holder, structureChoice)) { return; } @@ -333,8 +330,7 @@ public class ValidateStructureElementUtil { UUID uuid = structureElement.getUuid(); UUID parentUuid = structureElement.getParent(); - if ((Type.SYSTEMGROUP.equals(type) || Type.DISCIPLINE.equals(type)) - && parentUuid != null) { + if (ValidateUtil.isAnyEqual(type, Type.SYSTEMGROUP, Type.DISCIPLINE) && parentUuid != null) { throw ExceptionUtil.createDataNotCorrectException(TextUtil.PARENT_IS_NOT_CORRECT, details, field); } else if (StructureChoice.UPDATE.equals(structureChoice) || StructureChoice.DELETE.equals(structureChoice)) { validateStructuresStatusSize0( @@ -410,7 +406,7 @@ public class ValidateStructureElementUtil { // additional checks if names are affected // comment not same as previous comment - if (structureElement == null || namingConvention == null || holderRepositories == null || holder == null || structureChoice == null) { + if (ValidateUtil.isAnyNull(structureElement, namingConvention, holderRepositories, holder, structureChoice)) { return; } @@ -586,11 +582,11 @@ public class ValidateStructureElementUtil { listUuid = getStructures(type, parent, mnemonic, Status.PENDING, false, false, namingConvention, holderRepositories); validateConditionIfStructureChoice(StructureChoice.CREATE, structureChoice, listUuid.isEmpty(), message, details, field); - validateConditionIfStructureChoice(StructureChoice.UPDATE, structureChoice, listUuid.isEmpty() || listUuid.size() == 1 && listUuid.get(0).equals(uuid), message, details, field); + validateConditionIfStructureChoice(StructureChoice.UPDATE, structureChoice, ValidateUtil.isEmptyOrEquals(listUuid, uuid), message, details, field); listUuid = getStructures(type, parent, mnemonic, Status.APPROVED, false, false, namingConvention, holderRepositories); validateConditionIfStructureChoice(StructureChoice.CREATE, structureChoice, listUuid.isEmpty(), message, details, field); - validateConditionIfStructureChoice(StructureChoice.UPDATE, structureChoice, listUuid.isEmpty() || listUuid.size() == 1 && listUuid.get(0).equals(uuid), message, details, field); + validateConditionIfStructureChoice(StructureChoice.UPDATE, structureChoice, ValidateUtil.isEmptyOrEquals(listUuid, uuid), message, details, field); } private static void validateStructuresStatusMnemonicequivalence(UUID uuid, Type type, UUID parent, String mnemonic, EssNamingConvention namingConvention, HolderRepositories holderRepositories, StructureChoice structureChoice, @@ -602,11 +598,11 @@ public class ValidateStructureElementUtil { listUuid = getStructures(type, parent, mnemonic, Status.PENDING, false, true, namingConvention, holderRepositories); validateConditionIfStructureChoice(StructureChoice.CREATE, structureChoice, listUuid.isEmpty(), message, details, field); - validateConditionIfStructureChoice(StructureChoice.UPDATE, structureChoice, listUuid.isEmpty() || listUuid.size() == 1 && listUuid.get(0).equals(uuid), message, details, field); + validateConditionIfStructureChoice(StructureChoice.UPDATE, structureChoice, ValidateUtil.isEmptyOrEquals(listUuid, uuid), message, details, field); listUuid = getStructures(type, parent, mnemonic, Status.APPROVED, false, true, namingConvention, holderRepositories); validateConditionIfStructureChoice(StructureChoice.CREATE, structureChoice, listUuid.isEmpty(), message, details, field); - validateConditionIfStructureChoice(StructureChoice.UPDATE, structureChoice, listUuid.isEmpty() || listUuid.size() == 1 && listUuid.get(0).equals(uuid), message, details, field); + validateConditionIfStructureChoice(StructureChoice.UPDATE, structureChoice, ValidateUtil.isEmptyOrEquals(listUuid, uuid), message, details, field); } private static int getStructuresParentSize(Type type, UUID parent, Status status, Boolean deleted, HolderRepositories holderRepositories) { @@ -648,7 +644,7 @@ public class ValidateStructureElementUtil { // uuid, parent, mnemonic boolean queryParentTable = false; - if (Type.SYSTEMGROUP.equals(type) || Type.DISCIPLINE.equals(type)) { + if (ValidateUtil.isAnyEqual(type, Type.SYSTEMGROUP, Type.DISCIPLINE)) { // no parent - query table for type if (hasMnemonic) { } else { @@ -715,7 +711,7 @@ public class ValidateStructureElementUtil { * @param holder holder */ public static void validateStructureDataCreate(Type type, String mnemonicpath, EssNamingConvention namingConvention, HolderIRepositories holderIRepositories, HolderSystemDeviceStructure holder) { - if (type == null || mnemonicpath == null || namingConvention == null || holderIRepositories == null || holder == null) { + if (ValidateUtil.isAnyNull(type, mnemonicpath, namingConvention, holderIRepositories, holder)) { return; } diff --git a/src/main/java/org/openepics/names/util/ValidateUtil.java b/src/main/java/org/openepics/names/util/ValidateUtil.java index e376293667747e116895c7c2eeed053c222c8d4a..06582b2133cecb028966c3e9f1c9add34301bf39 100644 --- a/src/main/java/org/openepics/names/util/ValidateUtil.java +++ b/src/main/java/org/openepics/names/util/ValidateUtil.java @@ -19,6 +19,7 @@ package org.openepics.names.util; import java.util.Collection; +import java.util.List; import java.util.UUID; import org.apache.commons.lang3.StringUtils; @@ -211,4 +212,86 @@ public class ValidateUtil { return collection == null || collection.size() != size; } + /** + * Validate that list is equal to values. + * In practice, validate that both are null or both have same length and same content + * + * @param <T> type + * @param list list + * @param values values + * @return boolean if validation is ok + */ + @SafeVarargs + public static <T> boolean equals(List<T> list, T... values) { + if (list == null && values == null) { + return true; + } else if (list != null + && values != null + && list.size() == values.length) { + for (int i=0; i<list.size(); i++) { + if (list.get(i) != null + && values[i] != null + && !list.get(i).equals(values[i])) { + return false; + } + } + return true; + } else { + return false; + } + } + + /** + * Validate that list is empty or is equal to values. + * In practice, validate that list is not null and empty, or equal to values + * + * @param <T> type + * @param list list + * @param values values + * @return boolean if validation is ok + */ + @SafeVarargs + public static <T> boolean isEmptyOrEquals(List<T> list, T... values) { + return list != null && list.isEmpty() + || equals(list, values); + } + + /** + * Validate given objects such that <tt>true</tt> is returned if any object is null. + * This may be used to validate that given objects are not null. + * + * @param values values + * @return boolean if validation is ok + */ + public static boolean isAnyNull(Object... values) { + if (values == null) { + return true; + } + for (Object value : values) { + if (value == null) { + return true; + } + } + return false; + } + + /** + * Validate given objects such that <tt>true</tt> is returned if any object in values is equal to type. + * + * @param type type + * @param values values + * @return boolean if validation is ok + */ + public static boolean isAnyEqual(Type type, Type... values) { + if (isAnyNull(type, values)) { + return false; + } + for (Type value : values) { + if (type.equals(value)) { + return true; + } + } + return false; + } + } diff --git a/src/test/java/org/openepics/names/util/ValidateUtilTest.java b/src/test/java/org/openepics/names/util/ValidateUtilTest.java index 2dbaa8e077d95e3f588e537fedd32c38d185d45b..b36d77be8bde4cc2499cc4cfd3052878fe20b9cc 100644 --- a/src/test/java/org/openepics/names/util/ValidateUtilTest.java +++ b/src/test/java/org/openepics/names/util/ValidateUtilTest.java @@ -24,10 +24,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; import java.util.UUID; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import org.openepics.names.exception.InputNotAvailableException; import org.openepics.names.rest.beans.Type; @@ -354,6 +357,229 @@ class ValidateUtilTest { assertFalse(ValidateUtil.isNullOrNotSize(list, 2)); } + /** + * Test of validate list. + */ + @Test + void equals() { + List<String> list = null; + + assertFalse(ValidateUtil.equals(list, "")); + assertFalse(ValidateUtil.equals(list, "a")); + assertFalse(ValidateUtil.equals(list, "a", "a")); + assertFalse(ValidateUtil.equals(list, "a", "b")); + assertFalse(ValidateUtil.equals(list, "a", "b", "c")); + + list = new ArrayList<>(); + + assertFalse(ValidateUtil.equals(list, "")); + assertFalse(ValidateUtil.equals(list, "a")); + assertFalse(ValidateUtil.equals(list, "a", "a")); + assertFalse(ValidateUtil.equals(list, "a", "b")); + assertFalse(ValidateUtil.equals(list, "a", "b", "c")); + + list.add("a"); + + assertFalse(ValidateUtil.equals(list, "")); + assertTrue (ValidateUtil.equals(list, "a")); + assertFalse(ValidateUtil.equals(list, "a", "a")); + assertFalse(ValidateUtil.equals(list, "a", "b")); + assertFalse(ValidateUtil.equals(list, "a", "b", "c")); + + list.add("a"); + + assertFalse(ValidateUtil.equals(list, "")); + assertFalse(ValidateUtil.equals(list, "a")); + assertTrue (ValidateUtil.equals(list, "a", "a")); + assertFalse(ValidateUtil.equals(list, "a", "b")); + assertFalse(ValidateUtil.equals(list, "a", "b", "c")); + + list.remove(1); + list.add("b"); + + assertFalse(ValidateUtil.equals(list, "")); + assertFalse(ValidateUtil.equals(list, "a")); + assertFalse(ValidateUtil.equals(list, "a", "a")); + assertTrue (ValidateUtil.equals(list, "a", "b")); + assertFalse(ValidateUtil.equals(list, "a", "b", "c")); + } + + /** + * Test of validate list. + */ + @Test + void equalsUuid() { + List<UUID> list = null; + + UUID a = UUID.randomUUID(); + UUID b = UUID.randomUUID(); + UUID c = UUID.randomUUID(); + + assertFalse(ValidateUtil.equals(list, a)); + assertFalse(ValidateUtil.equals(list, a, a)); + assertFalse(ValidateUtil.equals(list, a, b)); + assertFalse(ValidateUtil.equals(list, a, b, c)); + + list = new ArrayList<>(); + + assertFalse(ValidateUtil.equals(list, a)); + assertFalse(ValidateUtil.equals(list, a, a)); + assertFalse(ValidateUtil.equals(list, a, b)); + assertFalse(ValidateUtil.equals(list, a, b, c)); + + list.add(a); + + assertTrue (ValidateUtil.equals(list, a)); + assertFalse(ValidateUtil.equals(list, a, a)); + assertFalse(ValidateUtil.equals(list, a, b)); + assertFalse(ValidateUtil.equals(list, a, b, c)); + + list.add(a); + + assertFalse(ValidateUtil.equals(list, a)); + assertTrue (ValidateUtil.equals(list, a, a)); + assertFalse(ValidateUtil.equals(list, a, b)); + assertFalse(ValidateUtil.equals(list, a, b, c)); + + list.remove(1); + list.add(b); + + assertFalse(ValidateUtil.equals(list, a)); + assertFalse(ValidateUtil.equals(list, a, a)); + assertTrue (ValidateUtil.equals(list, a, b)); + assertFalse(ValidateUtil.equals(list, a, b, c)); + } + + /** + * Test of validate list. + */ + @Test + void isEmptyOrEquals() { + List<String> list = null; + + assertFalse(ValidateUtil.isEmptyOrEquals(list, "")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "a")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "b")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "b", "c")); + + list = new ArrayList<>(); + + assertTrue (ValidateUtil.isEmptyOrEquals(list, "")); + assertTrue (ValidateUtil.isEmptyOrEquals(list, "a")); + assertTrue (ValidateUtil.isEmptyOrEquals(list, "a", "a")); + assertTrue (ValidateUtil.isEmptyOrEquals(list, "a", "b")); + assertTrue (ValidateUtil.isEmptyOrEquals(list, "a", "b", "c")); + + list.add("a"); + + assertFalse(ValidateUtil.isEmptyOrEquals(list, "")); + assertTrue (ValidateUtil.isEmptyOrEquals(list, "a")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "a")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "b")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "b", "c")); + + list.add("a"); + + assertFalse(ValidateUtil.isEmptyOrEquals(list, "")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a")); + assertTrue (ValidateUtil.isEmptyOrEquals(list, "a", "a")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "b")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "b", "c")); + + list.remove(1); + list.add("b"); + + assertFalse(ValidateUtil.isEmptyOrEquals(list, "")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "a")); + assertTrue (ValidateUtil.isEmptyOrEquals(list, "a", "b")); + assertFalse(ValidateUtil.isEmptyOrEquals(list, "a", "b", "c")); + } + + /** + * Test of validate an array if any object in array is null. + */ + @Test + void isAnyNull() { + String s = null; + Calendar c = null; + + assertTrue (ValidateUtil.isAnyNull(s)); + assertTrue (ValidateUtil.isAnyNull(c)); + assertTrue (ValidateUtil.isAnyNull(s, c)); + + s = "a"; + + assertFalse(ValidateUtil.isAnyNull(s)); + assertTrue (ValidateUtil.isAnyNull(c)); + assertTrue (ValidateUtil.isAnyNull(s, c)); + + s = null; + c = Calendar.getInstance(); + + assertTrue (ValidateUtil.isAnyNull(s)); + assertFalse(ValidateUtil.isAnyNull(c)); + assertTrue (ValidateUtil.isAnyNull(s, c)); + + s = "a"; + c = Calendar.getInstance(); + + assertFalse(ValidateUtil.isAnyNull(s)); + assertFalse(ValidateUtil.isAnyNull(c)); + assertFalse(ValidateUtil.isAnyNull(s, c)); + } + + /** + * Test to validate an array if any object in array is null. + * + * @param s string + * @param i integer + * @param f float + * @param expected expected + */ + @ParameterizedTest + @CsvSource(value = { + " , , ,true", + " , ,1,true", + " ,1, ,true", + " ,1,1,true", + "'1', , ,true", + "'1', ,1,true", + "'1',1, ,true", + "'1',1,1,false" + }) + void isAnyNullParameterized(String s, Integer i, Float f, boolean expected) { + assertEquals(expected, ValidateUtil.isAnyNull(s, i, f)); + } + + /** + * Test to validate an array if any object is equal to given type. + */ + @Test + void isAnyEqual() { + Type type = Type.SUBSYSTEM; + + assertFalse(ValidateUtil.isAnyEqual(type, Type.SYSTEMGROUP)); + assertFalse(ValidateUtil.isAnyEqual(type, Type.SYSTEM)); + assertTrue (ValidateUtil.isAnyEqual(type, Type.SUBSYSTEM)); + assertFalse(ValidateUtil.isAnyEqual(type, Type.DISCIPLINE)); + assertFalse(ValidateUtil.isAnyEqual(type, Type.DEVICEGROUP)); + assertFalse(ValidateUtil.isAnyEqual(type, Type.DEVICETYPE)); + + assertFalse(ValidateUtil.isAnyEqual(type, Type.SYSTEMGROUP, Type.SYSTEM)); + assertTrue (ValidateUtil.isAnyEqual(type, Type.SYSTEMGROUP, Type.SYSTEM, Type.SUBSYSTEM)); + assertTrue (ValidateUtil.isAnyEqual(type, Type.SYSTEMGROUP, Type.SYSTEM, Type.SUBSYSTEM, Type.DISCIPLINE)); + assertTrue (ValidateUtil.isAnyEqual(type, Type.SYSTEMGROUP, Type.SYSTEM, Type.SUBSYSTEM, Type.DISCIPLINE, Type.DEVICEGROUP)); + assertTrue (ValidateUtil.isAnyEqual(type, Type.SYSTEMGROUP, Type.SYSTEM, Type.SUBSYSTEM, Type.DISCIPLINE, Type.DEVICEGROUP, Type.DEVICETYPE)); + + assertFalse(ValidateUtil.isAnyEqual(type, Type.DEVICETYPE, Type.DEVICEGROUP)); + assertFalse(ValidateUtil.isAnyEqual(type, Type.DEVICETYPE, Type.DEVICEGROUP, Type.DISCIPLINE)); + assertTrue (ValidateUtil.isAnyEqual(type, Type.DEVICETYPE, Type.DEVICEGROUP, Type.DISCIPLINE, Type.SUBSYSTEM)); + assertTrue (ValidateUtil.isAnyEqual(type, Type.DEVICETYPE, Type.DEVICEGROUP, Type.DISCIPLINE, Type.SUBSYSTEM, Type.SYSTEM)); + assertTrue (ValidateUtil.isAnyEqual(type, Type.DEVICETYPE, Type.DEVICEGROUP, Type.DISCIPLINE, Type.SUBSYSTEM, Type.SYSTEM, Type.SYSTEMGROUP)); + } + // ---------------------------------------------------------------------------------------------------- /**