/** * Resolve. * * @param name the parent name * @param namespace the namespace * @param childName the child name * @return the array merge strategy * @throws OverrideException the merge exception */ public ArrayOverrideStrategy resolve(String name, String namespace, String childName) throws OverrideException { Schema schemaForParent = schemaTypes.get(namespace + "." + name); if (schemaForParent == null) { throw new OverrideException(MessageFormat.format( "Failed to find Schema with Name ''{0}'' and namespace ''{1}''", name, namespace)); } String mergeStrategyName = findMergeStrategy(schemaForParent, childName); ArrayOverrideStrategy mergeStrategy = null; if (mergeStrategyName != null) { mergeStrategy = ArrayOverrideStrategy.getByName(mergeStrategyName); } if (mergeStrategy == null) { mergeStrategy = ArrayOverrideStrategy.REPLACE; } return mergeStrategy; }
@Test public void testGetByNameFailsForIncorrectName() { ArrayOverrideStrategy arrayMergeStrategy = ArrayOverrideStrategy.getByName("incorrect_name"); Assert.assertNull(arrayMergeStrategy); } }