The following repo contains a new Live Football World Cup Scoreboard library that shows all the ongoing matches and their scores. It developed using TDD.
Run gradle.build
then Navigate to build > reports > tests
and open index.html
using a web browser.
To use the library all you need is just getting an instance of LiveScoreboardApi
.
LiveScoreboardApi liveScoreboardApi = LiveScoreboardApi.createInstance();
Then you can enjoy consuming the functionality.
To start a new match, just please use the following call. If the match has been started successfully, you get an object
of match Match
when you can very easily update and finish it.
If the match could not be start for any reason, a thrown exception StartNewMatchException
can tell about the reason.
Therefore, it should be surrounded using try catch
.
Match match = liveScoreboardApi.startNewMatch(String firstTeamName, String secondTeamName);
Once the score of the started match has been change, the match's score can be updated by the following. For some reason
the match could not be updated, for instance the match is already finished. At this point you are supposed to get an
exception telling the reason. Therefore, it should be surrounded using try catch
.
Match match = liveScoreboardApi.updateMatch(String id,
int firstTeamScore, int secondTeamScore);
When the time is over and match just finished, then you can finish the match by calling the following. It throws
an exception when match id is not found. Therefore, it should be surrounded using try catch
.
liveScoreboardApi.finshMatch(String id);
It is always beneficial to keep yourself update with the current matches in progress. An api can be used to draw all in
progress matches sorted by score. The matches with the same total score will be returned ordered by the most recently
started ones. This interface returns an object which is Scoreboard
where you can get List<Match>
as well as String
that draws the summery. An empty list and empty string are supposed to be got when there is not any match in progress
currently.
Scoreboard scoreboard = liveScoreboardApi.createScoreboard();
- Java 17
- Gradle
- JUnit 5
- Git
Enjoy your time with the Live Football World Cup Score