Skip to content

Conversation

@utzcoz
Copy link
Member

@utzcoz utzcoz commented May 19, 2024

Close #8997.

@utzcoz utzcoz force-pushed the throws-exception-if-class-is-abstract branch from 8f53304 to 1f7ca37 Compare May 19, 2024 08:50
@utzcoz
Copy link
Member Author

utzcoz commented May 19, 2024

New commit switches to throw RuntimeException with more accurate reason to follow ActivityScenario#launch result on Emulator.

@utzcoz utzcoz requested a review from hoisie May 19, 2024 08:54
@utzcoz
Copy link
Member Author

utzcoz commented May 19, 2024

cc @david-allison , please help to check whether this error message can meet your requirement.

@utzcoz utzcoz changed the title Throws IllegalArgumentException if buildActivity passed class is abstract Throws RuntimeException with more accurate error message if buildActivity passed class is abstract May 19, 2024
@utzcoz utzcoz force-pushed the throws-exception-if-class-is-abstract branch from 1f7ca37 to 90216d4 Compare May 19, 2024 09:14
Follow up the result of `ActivityScenario#launch` with abstract
Activity class, but Robolectric provides a different error message
to let developers know the real reason is the Activity class is
abstract.

Signed-off-by: utzcoz <utzcoz@outlook.com>
@utzcoz utzcoz force-pushed the throws-exception-if-class-is-abstract branch from 90216d4 to 1c2491d Compare May 19, 2024 09:16
Copy link

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

LGTM

Only question is the double-definition of AbstractTestActivity:

  • org.robolectric.testapp.AbstractTestActivity
  • org.robolectric.shadows.ShdowActivityTest.AbstractTestActivity

I presume this is a requirement of your testing frameworks

Thanks!

@utzcoz
Copy link
Member Author

utzcoz commented May 20, 2024

@david-allison Yeah. Two different Activity are used for different test suite. Thanks for your confirmation.

@utzcoz utzcoz merged commit 11623b9 into robolectric:master May 20, 2024
@utzcoz utzcoz deleted the throws-exception-if-class-is-abstract branch May 20, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message for Robolectric.buildActivity() if provided an abstract class

3 participants