Skip to content

Add AudioRecorderComponent sample tests#4169

Closed
shai-almog wants to merge 16 commits intomasterfrom
codex/port-audiorecordercomponentsample-to-unit-tests
Closed

Add AudioRecorderComponent sample tests#4169
shai-almog wants to merge 16 commits intomasterfrom
codex/port-audiorecordercomponentsample-to-unit-tests

Conversation

@shai-almog
Copy link
Collaborator

Summary

  • add a test-local copy of the AudioRecorderComponent sample for use in unit tests
  • create UI-driven tests that drive recording acceptance and cancellation using TestCodenameOneImplementation

Testing

  • mvn -f maven/core-unittests/pom.xml -Dtest=com.codename1.samples.AudioRecorderComponentSampleTest test (fails: missing dependency com.codenameone:codenameone-factory:8.0-SNAPSHOT)

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 172 to 176
private void createPlaceholderFile(String path) throws IOException {
FileWriter writer = new FileWriter(path);
try {
writer.write("recording");
} finally {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Placeholder file uses host FS instead of Codename One storage

The cancellation test builds a dummy recording file with new FileWriter(path) even though AudioRecorderComponentSample.recordAudio() returns Codename One file URLs (file://app/...) managed by the in-memory TestCodenameOneImplementation storage. Writing via java.io never populates that mock file system (and will throw when the file:// prefix resolves to a non-existent host directory), so the test either fails before exercising the cancel flow or checks deletion against the wrong location. Use FileSystemStorage/Codename One streams (and matching existence checks) so the placeholder resides in the same storage the component deletes.

Useful? React with 👍 / 👎.

@shai-almog shai-almog closed this Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant