### Question:
DefaultProviderTaskPropertiesAccessor implements ProviderTaskPropertiesAccessor { @Override public Optional<String> getTaskProperty(String taskName, String propertyKey) { if (StringUtils.isBlank(taskName) || StringUtils.isBlank(propertyKey)) { return Optional.empty(); } return providerTaskPropertiesRepository.findByTaskNameAndPropertyName(taskName, propertyKey).map(ProviderTaskPropertiesEntity::getValue); } @Autowired  DefaultProviderTaskPropertiesAccessor(ProviderTaskPropertiesRepository providerTaskPropertiesRepository); @Override Optional<String> getTaskProperty(String taskName, String propertyKey); @Override void setTaskProperty(Long configId, String taskName, String propertyKey, String propertyValue);  }### Answer:
@Test public void getTaskPropertyTest() { DefaultProviderTaskPropertiesAccessor providerTaskPropertiesAccessor = new DefaultProviderTaskPropertiesAccessor(providerTaskPropertiesRepository); Optional<String> taskPropertyValue = providerTaskPropertiesAccessor.getTaskProperty(taskName, propertyName); assertTrue(taskPropertyValue.isPresent()); assertEquals(value, taskPropertyValue.get()); }
@Test public void getTaskPropertyEmptyTest() { DefaultProviderTaskPropertiesAccessor providerTaskPropertiesAccessor = new DefaultProviderTaskPropertiesAccessor(providerTaskPropertiesRepository); Optional<String> taskPropertyOptionalEmpty = providerTaskPropertiesAccessor.getTaskProperty("invalidTaskName", "invalidPropertyKey"); Optional<String> taskPropertyValueEmpty = providerTaskPropertiesAccessor.getTaskProperty("", ""); assertFalse(taskPropertyOptionalEmpty.isPresent()); assertFalse(taskPropertyValueEmpty.isPresent()); }