Skip to content

Improve TranslationProvider implementation with modern Java syntax and proper stub #7

@coderabbitai

Description

@coderabbitai

Description

The current TranslationProvider implementation in src/test/java/com/flowingcode/vaadin/addons/cronexpressioneditor/TranslationProvider.java can be improved with modern Java syntax and a proper stub implementation.

Current Issues

  1. Uses legacy Collections.unmodifiableList(Arrays.asList()) instead of modern List.of()
  2. Returns null from getTranslation() method which may cause issues
  3. Contains TODO comment indicating incomplete implementation

Suggested Improvements

As suggested by @javier-godoy in PR #1:

@Override
public List<Locale> getProvidedLocales() {
  return List.of(Locale.ENGLISH);
}

@Override
public String getTranslation(String key, Locale locale, Object... params) {
  // Stub implementation for demo purposes
  return "\!"+key;
}

References

Acceptance Criteria

  • Replace Collections.unmodifiableList(Arrays.asList(Locale.ENGLISH)) with List.of(Locale.ENGLISH)
  • Implement proper stub for getTranslation() method that returns "\!" + key
  • Remove TODO comment
  • Ensure all tests still pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Inbox (needs triage)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions