Skip to content

Remove unnecessary annotations from Spring integration tests #2442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

EgorkaKulikov
Copy link
Collaborator

Description

  • Avoid setting default profile as active with annotation
  • Avoid setting unique application class as context with annotation
  • Render @SpringBootTest annotation on the top of others
  • Do not render @ExtendWith(SpringExtension.class) if @SpringBootTest is used.

How to test

Manual tests

Generate Spring integration tests for an arbitrary class in spring-boot-testing main.

Verify that annotations are the following for JUnit5

@SpringBootTest
@BootstrapWith(SpringBootTestContextBootstrapper.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
@Transactional
@AutoConfigureTestDatabase

with additional RunWith(SpringRunner.class) annotation for JUnit4

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@EgorkaKulikov EgorkaKulikov added ctg-enhancement New feature, improvement or change request comp-codegen Issue is related to code generator comp-spring Issue is related to Spring projects support labels Jul 24, 2023
@IlyaMuravjov IlyaMuravjov merged commit b67debe into main Jul 25, 2023
@IlyaMuravjov IlyaMuravjov deleted the egor/remove_useless_annotations_in_generated_code branch July 25, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-codegen Issue is related to code generator comp-spring Issue is related to Spring projects support ctg-enhancement New feature, improvement or change request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants