Skip to content
This repository was archived by the owner on Sep 16, 2020. It is now read-only.
This repository was archived by the owner on Sep 16, 2020. It is now read-only.

Initialising services via SymphonyClientConfigBuilder and SymphonyClientConfig #117

@dayoaws

Description

@dayoaws

Various services follow the pattern below which makes them hard to unit test.
public MessageService(SymphonyClient symClient) {
this.symClient = symClient;
//Lets startup the worker thread to listen for raw datafeed messages
dataFeedWorker = new DataFeedWorker(symClient, this);
new Thread(dataFeedWorker, "DataFeedWorker: "+ symClient.getName()).start();
}

To simplify and reduce the components that need to be initialised in unit testing, i suggest we extract the initialisation of the runnables out of the constructors into a private init method and perform the initialisation based on a new lazyInit attribute added to the ClientConfig and built using the ClientConfigBuilder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions