We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I recommend that you remove the static id field from Message and make it a non-static member of the MessageFactory. Then just add the current_id as argument of the Message constructor. This way, you avoid a global state and simplify unit testing.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Messages Order
You are viewing a single comment's thread. Return to all comments →
I recommend that you remove the static
id
field fromMessage
and make it a non-static member of theMessageFactory
. Then just add thecurrent_id
as argument of theMessage
constructor. This way, you avoid a global state and simplify unit testing.