From e5953dcf113544ccdc577b38990715189481a9e3 Mon Sep 17 00:00:00 2001 From: Anastasia Diseth Date: Tue, 1 Dec 2020 22:20:55 +0200 Subject: [PATCH] final details before release, back butten still buggy --- .../main/java/anadis/snakegame/domain/GameService.java | 1 - .../main/java/anadis/snakegame/domain/ScoreService.java | 8 ++++---- .../java/anadis/snakegame/domain/ScoreServiceTest.java | 8 ++++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/SnakeGame/src/main/java/anadis/snakegame/domain/GameService.java b/SnakeGame/src/main/java/anadis/snakegame/domain/GameService.java index f0d29a1..519423d 100644 --- a/SnakeGame/src/main/java/anadis/snakegame/domain/GameService.java +++ b/SnakeGame/src/main/java/anadis/snakegame/domain/GameService.java @@ -48,7 +48,6 @@ public boolean getGameOver() { public void timeInstance(GraphicsContext context) { this.context = context; Ui.back.setVisible(gameOver); - System.out.println(Ui.back); if (gameOver) { paintGameOver(); diff --git a/SnakeGame/src/main/java/anadis/snakegame/domain/ScoreService.java b/SnakeGame/src/main/java/anadis/snakegame/domain/ScoreService.java index 964c8b9..710cdd5 100644 --- a/SnakeGame/src/main/java/anadis/snakegame/domain/ScoreService.java +++ b/SnakeGame/src/main/java/anadis/snakegame/domain/ScoreService.java @@ -30,11 +30,11 @@ public void addScore(String name, int score) { } public VBox getScores() { - VBox list = new VBox(); + VBox scorelist = new VBox(); List scores = dao.topTwenty(); int rank = 1; if (scores.size() == 0) { - list.getChildren().add(new Label("No hightscores yet")); + scorelist.getChildren().add(new Label("No hightscores yet")); } else { for (Score score : scores) { StringBuilder sb = new StringBuilder(); @@ -48,10 +48,10 @@ public VBox getScores() { sb.append(" "); } sb.append(": "); - list.getChildren().add(new Label(sb.toString() + score.getScore())); + scorelist.getChildren().add(new Label(sb.toString() + score.getScore())); } } - return list; + return scorelist; } } diff --git a/SnakeGame/src/test/java/anadis/snakegame/domain/ScoreServiceTest.java b/SnakeGame/src/test/java/anadis/snakegame/domain/ScoreServiceTest.java index dc3e369..34a96d3 100644 --- a/SnakeGame/src/test/java/anadis/snakegame/domain/ScoreServiceTest.java +++ b/SnakeGame/src/test/java/anadis/snakegame/domain/ScoreServiceTest.java @@ -53,4 +53,12 @@ public void serviceDoesNotAddWhenScoreTooLow() { verify(dao, times(0)).add(anyObject()); } +// @Test +// public void returnsLabelWhenAskedForScores() { +// List scores = new ArrayList<>(); +// scores.add(new Score("bob", 12)); +// when(dao.topTwenty()).thenReturn(scores); +// scoreService.getScores(); +// verify(dao, times(1)).topTwenty(); +// } }