Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Should we replace most of the PowerMocking with singleton patterns? #380

Open

Description

@Salmela

We could replace most of the static classes with singletons like this:
https://gist.github.com/Salmela/a9dcedfeb055249b72110e2022ba00c9

Another way to get rid of staticness of the TmcUtil and the SettingsIo would be to add
getters for them in CliContext. Which could be replaced with Mockito spying or giving them
in the constructor.

Third way to fix the static classes could be dependency injection library like Guice,
but I don't have a clue how to integrate it easily into our project.

Activity

  1. changed the title [-]Should we replace most of the PowerMocking with singleton pattern?[/-] [+]Should we replace most of the PowerMocking with singleton patterns?[/+] on Jul 9, 2016
  2. jclc commented on Jul 10, 2016

    @jclc
    Contributor

    Is it really a good idea to replace static classes with instances? I thought we were moving away from this when I refactored SettingsIo and CourseInfoIo.

  3. Salmela commented on Jul 10, 2016

    @Salmela
    ContributorAuthor

    The unit testing of static classes is bit of a pain. But we have now tests for nearly all of the code so It would take lot of time to change the unit tests. And I think there is more important stuff to be done here.

    Also I unit tested some non-static util methods and their testing wasn't as easy as I would have hoped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions