### Question:
PropertiesResolver implements Verifications<T> { public Resolved<Set<T>> resolve(List<T> props, DefaultProperties defProps) { if (props == null) { return resolvedEmptyProps(); } DefaultProperties defaultProperties = createDefaultProperties(defProps); List<Resolved<T>> allResults = resolveAllProperties(props, defaultProperties); List<String> allErrors = allErrors(allResults); if (!allErrors.isEmpty()) { return propertiesResolveError(allErrors); } Set<T> allProperties = allProperties(allResults); Set<String> configNames = configNames(allProperties); if (configNames.size() != allProperties.size()) { return nonUniqueNamesError(); } return resolvedProperties(allProperties); } PropertiesResolver(DefaultProperties fallbackProps); Resolved<Set<T>> resolve(List<T> props, DefaultProperties defProps); abstract void verifications(Verifications<T> verifications); @SuppressWarnings("unchecked") @Override void addVerifications(Function<T, Optional<String>>... functions);  }### Answer:
@Test public void resolveBothEmpty() { Resolved<Set<T>> resolved = propertiesResolver .resolve(null, null); assertThat(resolved.isErr()).isFalse(); assertThat(resolved.succ()).isEmpty(); }
@Test public void resolvePropsEmpty() { Resolved<Set<T>> resolved = propertiesResolver .resolve(null, mockDefProps); assertThat(resolved.isErr()).isFalse(); assertThat(resolved.succ()).isEmpty(); }
@Test public void resolvePropsNoDef() { Resolved<Set<T>> resolved = propertiesResolver .resolve(Collections.singletonList(mockProps), null); assertThat(resolved.isErr()).isFalse(); assertThat(resolved.succ()).hasSize(1); }
@Test public void resolveCompletePropsHasDef() { Resolved<Set<T>> resolved = propertiesResolver .resolve(Collections.singletonList(copy(mockProps)), mockDefProps); assertThat(resolved.isErr()).isFalse(); assertThat(resolved.succ()).hasSize(1); T properties = resolved.succ().iterator().next(); assertThat(properties.getCodecs()).isEqualTo(mockProps.getCodecs()); assertThat(properties.getTransport()).isEqualTo(mockProps.getTransport()); }
@Test public void resolveNonCompletePropsHasDef() { T props = copy(mockProps); props.setTransport(null); props.setCodecs(null); Resolved<Set<T>> resolved = propertiesResolver .resolve(Collections.singletonList(props), mockDefProps); assertThat(resolved.isErr()).isFalse(); assertThat(resolved.succ()).hasSize(1); T properties = resolved.succ().iterator().next(); assertThat(properties.getCodecs()).isEqualTo(mockDefProps.getCodecs()); assertThat(properties.getTransport()).isEqualTo(mockDefProps.getTransport()); }
@Test public void resolveMissingApisProps() { T props = copy(mockProps); props.setResponders(null); Resolved<Set<T>> resolved = propertiesResolver .resolve(Collections.singletonList(props), mockDefProps); assertThat(resolved.isErr()).isFalse(); assertThat(resolved.succ()).hasSize(1); }
@Test public void resolveInvalidNameProps() { T props = copy(mockProps); props.setName(null); Resolved<Set<T>> resolved = propertiesResolver .resolve(Collections.singletonList(props), mockDefProps); assertThat(resolved.isErr()).isTrue(); assertThat(resolved.err()).hasSize(1); }
@Test public void resolveDuplicateNameProps() { T props1 = copy(mockProps); T props2 = copy(mockProps); Resolved<Set<T>> resolved = propertiesResolver .resolve(Arrays.asList(props1, props2), mockDefProps); assertThat(resolved.isErr()).isTrue(); assertThat(resolved.err()).hasSize(1); }
@Test public void resolveDisabledProps() { T props = copy(mockProps); props.setEnabled(false); Resolved<Set<T>> resolved = propertiesResolver .resolve(Collections.singletonList(props), mockDefProps); assertThat(resolved.isErr()).isFalse(); assertThat(resolved.succ()).hasSize(0); }