diff --git a/src/main/java/org/openepics/names/rest/controller/GlobalControllerExceptionHandler.java b/src/main/java/org/openepics/names/rest/controller/GlobalControllerExceptionHandler.java index 5aaf9bddcb89a4a59800d5ea5a4b9807aff648bb..2e36231f6ed5d3d0b6a36950d89c5352c57df98b 100644 --- a/src/main/java/org/openepics/names/rest/controller/GlobalControllerExceptionHandler.java +++ b/src/main/java/org/openepics/names/rest/controller/GlobalControllerExceptionHandler.java @@ -66,8 +66,7 @@ public class GlobalControllerExceptionHandler extends ResponseEntityExceptionHan HttpStatus resultStatus = HttpStatus.INTERNAL_SERVER_ERROR; - if (ex instanceof ServiceException) { - ServiceException se = (ServiceException) ex; + if (ex instanceof ServiceException se) { response.setMessage(StringUtils.trimToEmpty(ex.getMessage())); response.setDetails(StringUtils.trimToEmpty(se.getDetails())); response.setField(StringUtils.trimToEmpty(se.getField())); diff --git a/src/main/java/org/openepics/names/util/EssNamingConvention.java b/src/main/java/org/openepics/names/util/EssNamingConvention.java index d1b8aba11db3747a3d7045026b2c90fdaac9575d..4c49ac787ba1926a64b8c9627b3c8f43b98cdf03 100644 --- a/src/main/java/org/openepics/names/util/EssNamingConvention.java +++ b/src/main/java/org/openepics/names/util/EssNamingConvention.java @@ -152,7 +152,7 @@ public class EssNamingConvention implements NamingConvention { // same mnemonic only once in mnemonic path if (!StringUtils.isEmpty(mnemonicPath)) { String[] values = NamingConventionUtil.string2MnemonicPath(mnemonicPath.trim()); - if (values.length < 0 || values.length > 3) { + if (values.length > 3) { return false; } switch (values.length) { @@ -171,20 +171,17 @@ public class EssNamingConvention implements NamingConvention { return false; } - @Override - public boolean isMnemonicRequired(Type type) { - if (type != null - && (Type.SYSTEM.equals(type) - || Type.SUBSYSTEM.equals(type) - || Type.DISCIPLINE.equals(type) - || Type.DEVICETYPE.equals(type))) { - return true; - } - return false; - } - - @Override - public MnemonicValidation validateMnemonic(Type type, String mnemonic) { + @Override + public boolean isMnemonicRequired(Type type) { + return type != null + && (Type.SYSTEM.equals(type) + || Type.SUBSYSTEM.equals(type) + || Type.DISCIPLINE.equals(type) + || Type.DEVICETYPE.equals(type)); + } + + @Override + public MnemonicValidation validateMnemonic(Type type, String mnemonic) { // mnemonic validation for system and device structure elements // rules for characters // depends on system/device structure, required or not @@ -203,24 +200,24 @@ public class EssNamingConvention implements NamingConvention { // accelerator as system // system group as system, not required - if (type != null) { - boolean empty = StringUtils.isEmpty(mnemonic); - int length = empty ? 0 : mnemonic.length(); - boolean length1to6 = (length >= 1) && (length <= 6); - boolean length1to8 = (length >= 1) && (length <= 8); - boolean matchMnemonic = !empty && mnemonic.matches(MNEMONIC_ALPHANUMERIC); + if (type != null) { + boolean empty = StringUtils.isEmpty(mnemonic); + int length = empty ? 0 : mnemonic.length(); + boolean length1to6 = (length >= 1) && (length <= 6); + boolean length1to8 = (length >= 1) && (length <= 8); + boolean matchMnemonic = !empty && mnemonic.matches(MNEMONIC_ALPHANUMERIC); - MnemonicValidation result = MnemonicValidation.VALID; + MnemonicValidation result = MnemonicValidation.VALID; - if (Type.SYSTEMGROUP.equals(type)) { + if (Type.SYSTEMGROUP.equals(type)) { if (empty) { - result = MnemonicValidation.VALID; + return result; } else if (!length1to6) { result = MnemonicValidation.TOO_LONG; } else if (!matchMnemonic) { result = MnemonicValidation.NON_ACCEPTABLE_CHARS; } - } else if (Type.SYSTEM.equals(type) || Type.SUBSYSTEM.equals(type)) { + } else if (Type.SYSTEM.equals(type) || Type.SUBSYSTEM.equals(type)) { if (empty) { result = MnemonicValidation.EMPTY; } else if (!length1to8) { @@ -228,7 +225,7 @@ public class EssNamingConvention implements NamingConvention { } else if (!matchMnemonic) { result = MnemonicValidation.NON_ACCEPTABLE_CHARS; } - } else if (Type.DISCIPLINE.equals(type) || Type.DEVICETYPE.equals(type)) { + } else if (Type.DISCIPLINE.equals(type) || Type.DEVICETYPE.equals(type)) { if (empty) { result = MnemonicValidation.EMPTY; } else if (!length1to6) { @@ -236,15 +233,15 @@ public class EssNamingConvention implements NamingConvention { } else if (!matchMnemonic) { result = MnemonicValidation.NON_ACCEPTABLE_CHARS; } - } else if (Type.DEVICEGROUP.equals(type)) { + } else if (Type.DEVICEGROUP.equals(type)) { if (!empty) { result = MnemonicValidation.NON_ACCEPTABLE_CHARS; } - } + } - return result; - } - return null; - } + return result; + } + return null; + } } diff --git a/src/main/java/org/openepics/names/util/HolderSystemDeviceStructure.java b/src/main/java/org/openepics/names/util/HolderSystemDeviceStructure.java index 9ae0ee0951ccdd980d26a90384f9753f82cffcc6..3c7eff656cf687685fc395a09a56b6d2cbb27816 100644 --- a/src/main/java/org/openepics/names/util/HolderSystemDeviceStructure.java +++ b/src/main/java/org/openepics/names/util/HolderSystemDeviceStructure.java @@ -67,56 +67,56 @@ public class HolderSystemDeviceStructure { * @param includeDeleted include deleted structure entries */ public HolderSystemDeviceStructure (HolderIRepositories holderIRepositories, boolean includeDeleted) { - List<SystemGroup> systemGroups = null; - List<System> systems = null; - List<Subsystem> subsystems = null; - List<Discipline> disciplines = null; - List<DeviceGroup> deviceGroups = null; - List<DeviceType> deviceTypes = null; + List<SystemGroup> systemGroupsRead = null; + List<System> systemsRead = null; + List<Subsystem> subsystemsRead = null; + List<Discipline> disciplinesRead = null; + List<DeviceGroup> deviceGroupsRead = null; + List<DeviceType> deviceTypesRead = null; if (includeDeleted) { - systemGroups = holderIRepositories.getSystemGroupRepository().findLatest(); - systems = holderIRepositories.getSystemRepository().findLatest(); - subsystems = holderIRepositories.getSubsystemRepository().findLatest(); - disciplines = holderIRepositories.getDisciplineRepository().findLatest(); - deviceGroups = holderIRepositories.getDeviceGroupRepository().findLatest(); - deviceTypes = holderIRepositories.getDeviceTypeRepository().findLatest(); + systemGroupsRead = holderIRepositories.getSystemGroupRepository().findLatest(); + systemsRead = holderIRepositories.getSystemRepository().findLatest(); + subsystemsRead = holderIRepositories.getSubsystemRepository().findLatest(); + disciplinesRead = holderIRepositories.getDisciplineRepository().findLatest(); + deviceGroupsRead = holderIRepositories.getDeviceGroupRepository().findLatest(); + deviceTypesRead = holderIRepositories.getDeviceTypeRepository().findLatest(); } else { - systemGroups = holderIRepositories.getSystemGroupRepository().findLatestNotDeleted(); - systems = holderIRepositories.getSystemRepository().findLatestNotDeleted(); - subsystems = holderIRepositories.getSubsystemRepository().findLatestNotDeleted(); - disciplines = holderIRepositories.getDisciplineRepository().findLatestNotDeleted(); - deviceGroups = holderIRepositories.getDeviceGroupRepository().findLatestNotDeleted(); - deviceTypes = holderIRepositories.getDeviceTypeRepository().findLatestNotDeleted(); + systemGroupsRead = holderIRepositories.getSystemGroupRepository().findLatestNotDeleted(); + systemsRead = holderIRepositories.getSystemRepository().findLatestNotDeleted(); + subsystemsRead = holderIRepositories.getSubsystemRepository().findLatestNotDeleted(); + disciplinesRead = holderIRepositories.getDisciplineRepository().findLatestNotDeleted(); + deviceGroupsRead = holderIRepositories.getDeviceGroupRepository().findLatestNotDeleted(); + deviceTypesRead = holderIRepositories.getDeviceTypeRepository().findLatestNotDeleted(); } // initial capacity // default load factor 0.75 // set at proper size to avoid rehashing // size/0.75+1 (may be rounded downwards so possibly +2 instead) - this.systemGroups = new HashMap<>((int)(systemGroups.size()/0.75 + 2)); - this.systems = new HashMap<>((int)(systems.size()/0.75 + 2)); - this.subsystems = new HashMap<>((int)(subsystems.size()/0.75 + 2)); - this.disciplines = new HashMap<>((int)(disciplines.size()/0.75 + 2)); - this.deviceGroups = new HashMap<>((int)(deviceGroups.size()/0.75 + 2)); - this.deviceTypes = new HashMap<>((int)(deviceTypes.size()/0.75 + 2)); - - for (SystemGroup systemGroup : systemGroups) { + this.systemGroups = new HashMap<>((int)(systemGroupsRead.size()/0.75 + 2)); + this.systems = new HashMap<>((int)(systemsRead.size()/0.75 + 2)); + this.subsystems = new HashMap<>((int)(subsystemsRead.size()/0.75 + 2)); + this.disciplines = new HashMap<>((int)(disciplinesRead.size()/0.75 + 2)); + this.deviceGroups = new HashMap<>((int)(deviceGroupsRead.size()/0.75 + 2)); + this.deviceTypes = new HashMap<>((int)(deviceTypesRead.size()/0.75 + 2)); + + for (SystemGroup systemGroup : systemGroupsRead) { this.systemGroups.put(systemGroup.getUuid(), systemGroup); } - for (System system : systems) { + for (System system : systemsRead) { this.systems.put(system.getUuid(), system); } - for (Subsystem subsystem : subsystems) { + for (Subsystem subsystem : subsystemsRead) { this.subsystems.put(subsystem.getUuid(), subsystem); } - for (Discipline discipline : disciplines) { + for (Discipline discipline : disciplinesRead) { this.disciplines.put(discipline.getUuid(), discipline); } - for (DeviceGroup deviceGroup : deviceGroups) { + for (DeviceGroup deviceGroup : deviceGroupsRead) { this.deviceGroups.put(deviceGroup.getUuid(), deviceGroup); } - for (DeviceType deviceType : deviceTypes) { + for (DeviceType deviceType : deviceTypesRead) { this.deviceTypes.put(deviceType.getUuid(), deviceType); } } diff --git a/src/main/java/org/openepics/names/util/NameElementUtil.java b/src/main/java/org/openepics/names/util/NameElementUtil.java index 7141fb592487dde4900caf83b8947f3bda64d2cc..43c69706d413857688e1866e39c1b06a435e7806 100644 --- a/src/main/java/org/openepics/names/util/NameElementUtil.java +++ b/src/main/java/org/openepics/names/util/NameElementUtil.java @@ -186,68 +186,4 @@ public class NameElementUtil { return true; } -// /** -// * Populate and return name element for name. -// * -// * @param name name -// * @param holderSystemDeviceStructure holder of containers for system and device structure content -// * @return name element -// */ -// public static NameElement getNameElement(Name name, HolderSystemDeviceStructure holderSystemDeviceStructure) { -// if (name == null) { -// return null; -// } -// -// // find out how to populate return element for system structure, device structure -// // levelSystemStructure -1 ---> error -// // levelDeviceStructure -1 ---> error -// -// return new NameElement( -// name.getUuid(), -// name.getSystemgroupUuid(), name.getSystemUuid(), name.getSubsystemUuid(), name.getDevicetypeUuid(), -// getMnemonicPathSystemStructure( -// name, -// StructureUtil.getLevelSystemStructure(name), -// holderSystemDeviceStructure), -// getMnemonicPathDeviceStructure( -// name, -// StructureUtil.getLevelDeviceStructure(name), -// holderSystemDeviceStructure), -// name.getInstanceIndex(), name.getConventionName(), -// name.getDescription(), Status.APPROVED, name.isLatest(), name.isDeleted(), -// name.getRequested(), name.getRequestedBy(), name.getRequestedComment()); -// } -// -// /** -// * Populate and return name element for name. -// * -// * @param name name -// * @param holderIRepositories holder of references to repositories -// * @return name element -// */ -// public static NameElement getNameElement(Name name, HolderIRepositories holderIRepositories) { -// if (name == null) { -// return null; -// } -// -// // find out how to populate return element for system structure, device structure -// // levelSystemStructure -1 ---> error -// // levelDeviceStructure -1 ---> error -// -// return new NameElement( -// name.getUuid(), -// name.getSystemgroupUuid(), name.getSystemUuid(), name.getSubsystemUuid(), name.getDevicetypeUuid(), -// getMnemonicPathSystemStructure( -// name, -// StructureUtil.getLevelSystemStructure(name), -// holderIRepositories), -// getMnemonicPathDeviceStructure( -// name, -// StructureUtil.getLevelDeviceStructure(name), -// holderIRepositories), -// name.getInstanceIndex(), name.getConventionName(), -// name.getDescription(), Status.APPROVED, name.isLatest(), name.isDeleted(), -// name.getRequested(), name.getRequestedBy(), name.getRequestedComment()); -// } - } diff --git a/src/main/java/org/openepics/names/util/NameUtil.java b/src/main/java/org/openepics/names/util/NameUtil.java index e8153db83ac34fecf6499d2d80d06f8e0485ea0d..a33ef15c2b97acdcea5f202e6655ab1f86d690d0 100644 --- a/src/main/java/org/openepics/names/util/NameUtil.java +++ b/src/main/java/org/openepics/names/util/NameUtil.java @@ -132,120 +132,4 @@ public class NameUtil { : null; } -// /** -// * Return system structure mnemonic path for name. -// * -// * @param name name -// * @param levelSystemStructure level of system structure -// * @param holderIRepositories holder of references to repositories -// * @return system structure mnemonic path -// */ -// private static String getMnemonicPathSystemStructure(Name name, int levelSystemStructure, HolderIRepositories holderIRepositories) { -// // populate return element for system structure -// switch (levelSystemStructure) { -// case 3: { -// Subsystem subsystem = holderIRepositories.getSubsystemRepository().findLatestByUuid(name.getSubsystemUuid().toString()); -// System system = holderIRepositories.getSystemRepository().findLatestByUuid(subsystem.getParentUuid().toString()); -// -// return system.getMnemonic() + "-" + subsystem.getMnemonic(); -// } -// case 2: { -// System system = holderIRepositories.getSystemRepository().findLatestByUuid(name.getSystemUuid().toString()); -// -// return system.getMnemonic(); -// } -// case 1: { -// SystemGroup systemGroup = holderIRepositories.getSystemGroupRepository().findLatestByUuid(name.getSystemgroupUuid().toString()); -// -// return systemGroup.getMnemonic(); -// } -// default: -// // error -// return null; -// } -// } -// -// /** -// * Return device structure mnemonic path for name. -// * -// * @param name name -// * @param levelDeviceStructure level of device structure -// * @param holderIRepositories holder of references to repositories -// * @return device structure mnemonic path -// */ -// private static String getMnemonicPathDeviceStructure(Name name, int levelDeviceStructure, HolderIRepositories holderIRepositories) { -// // populate return element for device structure -// switch (levelDeviceStructure) { -// case 3: { -// DeviceType deviceType = holderIRepositories.getDeviceTypeRepository().findLatestByUuid(name.getDevicetypeUuid().toString()); -// DeviceGroup deviceGroup = holderIRepositories.getDeviceGroupRepository().findLatestByUuid(deviceType.getParentUuid().toString()); -// Discipline discipline = holderIRepositories.getDisciplineRepository().findLatestByUuid(deviceGroup.getParentUuid().toString()); -// -// return discipline.getMnemonic() + "-" + deviceType.getMnemonic(); -// } -// default: -// // error -// return null; -// } -// -// } -// -// /** -// * Return system structure mnemonic path for name. -// * -// * @param name name -// * @param levelSystemStructure level of system structure -// * @param holderSystemDeviceStructure holder of containers for system and device structure content -// * @return system structure mnemonic path -// */ -// private static String getMnemonicPathSystemStructure(Name name, int levelSystemStructure, HolderSystemDeviceStructure holderSystemDeviceStructure) { -// // populate return element for system structure -// switch (levelSystemStructure) { -// case 3: { -// Subsystem subsystem = holderSystemDeviceStructure.findSubsystemByUuid(name.getSubsystemUuid()); -// System system = holderSystemDeviceStructure.findSystemByUuid(subsystem.getParentUuid()); -// -// return system.getMnemonic() + "-" + subsystem.getMnemonic(); -// } -// case 2: { -// System system = holderSystemDeviceStructure.findSystemByUuid(name.getSystemUuid()); -// -// return system.getMnemonic(); -// } -// case 1: { -// SystemGroup systemGroup = holderSystemDeviceStructure.findSystemGroupByUuid(name.getSystemgroupUuid()); -// -// return systemGroup.getMnemonic(); -// } -// default: -// // error -// return null; -// } -// } -// -// /** -// * Return device structure mnemonic path for name. -// * -// * @param name name -// * @param levelDeviceStructure level of device structure -// * @param holderSystemDeviceStructure holder of containers for system and device structure content -// * @return device structure mnemonic path -// */ -// private static String getMnemonicPathDeviceStructure(Name name, int levelDeviceStructure, HolderSystemDeviceStructure holderSystemDeviceStructure) { -// // populate return element for device structure -// switch (levelDeviceStructure) { -// case 3: { -// DeviceType deviceType = holderSystemDeviceStructure.findDeviceTypeByUuid(name.getDevicetypeUuid()); -// DeviceGroup deviceGroup = holderSystemDeviceStructure.findDeviceGroupByUuid(deviceType.getParentUuid()); -// Discipline discipline = holderSystemDeviceStructure.findDisciplineByUuid(deviceGroup.getParentUuid()); -// -// return discipline.getMnemonic() + "-" + deviceType.getMnemonic(); -// } -// default: -// // error -// return null; -// } -// -// } - } diff --git a/src/main/java/org/openepics/names/util/NamingConventionUtil.java b/src/main/java/org/openepics/names/util/NamingConventionUtil.java index 38b59dac824525f11ed3b3ac80b386cd5ce24f84..51e5abfe07777c1347bdffc3cd6cf9e52e88f564 100644 --- a/src/main/java/org/openepics/names/util/NamingConventionUtil.java +++ b/src/main/java/org/openepics/names/util/NamingConventionUtil.java @@ -99,6 +99,8 @@ public class NamingConventionUtil { public static final String DELIMITER_EXTRA = ":"; public static final String DELIMITER_INTRA = "-"; + private static final String[] EMPTY_ARRAY = new String[] {}; + /** * This class is not to be instantiated. */ @@ -450,7 +452,7 @@ public class NamingConventionUtil { if (name != null) { return StringUtils.split(name, DELIMITER_INTRA); } - return null; + return EMPTY_ARRAY; } /** diff --git a/src/main/java/org/openepics/names/util/StructureElementUtil.java b/src/main/java/org/openepics/names/util/StructureElementUtil.java index bfaf04980a4019ccc71e53e2800c298577f05cff..919abe9375130b6d2a77272104203f172ca75445 100644 --- a/src/main/java/org/openepics/names/util/StructureElementUtil.java +++ b/src/main/java/org/openepics/names/util/StructureElementUtil.java @@ -631,6 +631,9 @@ public class StructureElementUtil { if (!hasSameContent(structureElement, (NameStructure) structure)) return false; + if (structureElement == null) + return false; + if (structureElement.getName() == null) { if (structure.getName() != null) return false; @@ -655,11 +658,7 @@ public class StructureElementUtil { if (!hasSameContent(structureElement, (Structure) systemGroup)) return false; - if (!Type.SYSTEMGROUP.equals(structureElement.getType())) { - return false; - } - - return true; + return Type.SYSTEMGROUP.equals(structureElement.getType()); } public static boolean hasSameContent(StructureElement structureElement, System system) { @@ -674,7 +673,7 @@ public class StructureElementUtil { if (!hasSameContent(structureElement, (Structure) system)) return false; - if (!Type.SYSTEMGROUP.equals(structureElement.getType())) { + if (!Type.SYSTEM.equals(structureElement.getType())) { return false; } if (structureElement.getParent() == null) { @@ -698,7 +697,7 @@ public class StructureElementUtil { if (!hasSameContent(structureElement, (Structure) subsystem)) return false; - if (!Type.SYSTEMGROUP.equals(structureElement.getType())) { + if (!Type.SUBSYSTEM.equals(structureElement.getType())) { return false; } if (structureElement.getParent() == null) { @@ -720,11 +719,7 @@ public class StructureElementUtil { if (!hasSameContent(structureElement, (Structure) discipline)) return false; - if (!Type.SYSTEMGROUP.equals(structureElement.getType())) { - return false; - } - - return true; + return Type.DISCIPLINE.equals(structureElement.getType()); } public static boolean hasSameContent(StructureElement structureElement, DeviceGroup deviceGroup) { @@ -739,7 +734,7 @@ public class StructureElementUtil { if (!hasSameContent(structureElement, (Structure) deviceGroup)) return false; - if (!Type.SYSTEMGROUP.equals(structureElement.getType())) { + if (!Type.DEVICEGROUP.equals(structureElement.getType())) { return false; } if (structureElement.getParent() == null) { @@ -763,7 +758,7 @@ public class StructureElementUtil { if (!hasSameContent(structureElement, (Structure) deviceType)) return false; - if (!Type.SYSTEMGROUP.equals(structureElement.getType())) { + if (!Type.DEVICETYPE.equals(structureElement.getType())) { return false; } if (structureElement.getParent() == null) { diff --git a/src/main/java/org/openepics/names/util/ValidateUtil.java b/src/main/java/org/openepics/names/util/ValidateUtil.java index 323aa70c6bc7a0d74c32cd107628869b68456901..4b91a80f163f7dc58bee7d133e31a65dfd2c57f2 100644 --- a/src/main/java/org/openepics/names/util/ValidateUtil.java +++ b/src/main/java/org/openepics/names/util/ValidateUtil.java @@ -537,10 +537,9 @@ public class ValidateUtil { if (sub != null) { count++; } - if (count > 2 || count < 1) { - throw ExceptionUtil.createDataNotCorrectException("system structure " + TextUtil.IS_NOT_CORRECT, name, null); - } else if ( (!StringUtils.isEmpty(sg) && !StringUtils.isEmpty(sys)) - || (!StringUtils.isEmpty(sg) && !StringUtils.isEmpty(sub))) { + if (count > 2 || count < 1 || + ((!StringUtils.isEmpty(sg) && !StringUtils.isEmpty(sys)) + || (!StringUtils.isEmpty(sg) && !StringUtils.isEmpty(sub)))) { throw ExceptionUtil.createDataNotCorrectException("system structure " + TextUtil.IS_NOT_CORRECT, name, null); } @@ -554,17 +553,13 @@ public class ValidateUtil { boolean condition = true; // ensure that system structure parents and device structure parents are available, latest and not deleted - // if (device type) { - // } - // if (system group) { - // } else { - // if (system) { - // } else { + // if device type + // if system group + // else + // if system + // else // (if not system then error) - // } - // if (subsystem) { - // } - // } + // if subsystem // device structure if (!StringUtils.isEmpty(dt)) { @@ -746,14 +741,13 @@ public class ValidateUtil { validateInputType(structureElement.getType()); if (!StructureChoice.DELETE.equals(structureChoice)) { - switch (structureElement.getType()) { - case SYSTEM, SUBSYSTEM, DEVICEGROUP, DEVICETYPE: - ExceptionUtil.validateConditionInputNotAvailableException(structureElement.getParent() != null, - "parent uuid " + TextUtil.IS_NOT_AVAILABLE, structureElement.toString(), "parent"); - ValidateUtil.validateInputUuid(structureElement.getParent().toString()); - break; - default: - break; + if (Type.SYSTEM.equals(structureElement.getType()) + || Type.SUBSYSTEM.equals(structureElement.getType()) + || Type.DEVICEGROUP.equals(structureElement.getType()) + || Type.DEVICETYPE.equals(structureElement.getType())) { + ExceptionUtil.validateConditionInputNotAvailableException(structureElement.getParent() != null, + "parent uuid " + TextUtil.IS_NOT_AVAILABLE, structureElement.toString(), "parent"); + ValidateUtil.validateInputUuid(structureElement.getParent().toString()); } validateInputName(structureElement.getName()); diff --git a/src/test/java/org/openepics/names/util/NamingConventionUtilTest.java b/src/test/java/org/openepics/names/util/NamingConventionUtilTest.java index 9e1e1d0c898c452603e6e71b7f85564b5499a713..93c9d4ac57ea81ff7bb91a9119ef07dbafc3bd7f 100644 --- a/src/test/java/org/openepics/names/util/NamingConventionUtilTest.java +++ b/src/test/java/org/openepics/names/util/NamingConventionUtilTest.java @@ -415,7 +415,8 @@ class NamingConventionUtilTest { String[] array = null; array = NamingConventionUtil.string2MnemonicPath(null); - assertNull(array); + assertNotNull(array); + assertEquals(0, array.length); array = NamingConventionUtil.string2MnemonicPath(""); assertNotNull(array);