Skip to content

Conversation

@MihaiCristianCondrea
Copy link
Owner

Summary

  • add unit tests for DefaultHomeRemoteDataSource JSON parsing
  • verify own package entries are filtered and malformed data returns empty list

Testing

  • ./gradlew test (fails: SDK location not found)

https://chatgpt.com/codex/tasks/task_e_68c66132851c832d8e8c59ab5eb04e67

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 suggestions.

Reply with @codex fix comments to fix any unresolved comments.

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, or 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 fix this CI failure" or "@codex address that feedback".

Comment on lines 24 to 36
@Before
public void setUp() throws Exception {
if (Looper.getMainLooper() == null) {
try {
Method prepareMainLooper = Looper.class.getDeclaredMethod("prepareMainLooper");
prepareMainLooper.setAccessible(true);
prepareMainLooper.invoke(null);
} catch (Exception ignored) {
Looper.prepare();
}
}
RequestQueue queue = mock(RequestQueue.class);
dataSource = new DefaultHomeRemoteDataSource(queue, "https://example.com");

Choose a reason for hiding this comment

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

[P1] Move remote data source tests off JVM

The new unit tests build a DefaultHomeRemoteDataSource in a local JVM test. Instantiating that class calls new Handler(Looper.getMainLooper()), but the JVM test environment ships only the stubbed android.os.Looper from android.jar. When ./gradlew test runs with a valid SDK, the call to Looper.getMainLooper() will throw RuntimeException: Method getMainLooper in android.os.Looper not mocked, so the entire test task fails before assertions execute. These tests need to run under Robolectric or the instrumentation androidTest source set, or the DefaultHomeRemoteDataSource should be refactored to avoid framework classes in local tests.

Useful? React with 👍 / 👎.

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.

2 participants