From 452ccdacef4c2b74b5668aae04ae8acaf4c10f3e Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Thu, 10 Feb 2022 21:38:58 +0100 Subject: [PATCH] added getBR3InfoByTime() & added Tests --- src/main/java/device/radioPlayer/RadioPlayer.java | 15 +++++++++++++++ .../java/device/radioPlayer/RadioPlayerTest.java | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index bf24e5b..ce419ce 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -7,6 +7,8 @@ import java.util.ArrayList; public class RadioPlayer implements Device { + private int x; + public RadioPlayer() { super(); Playlist.add("YouFM"); @@ -31,6 +33,19 @@ public class RadioPlayer implements Device { String[] YouFMInfo = {"YOUFM Good Morning Show", "YOUFM Worktime", "YOUFM am Nachmittag", "YOUFM am Abend", "YOUFM Wir feiern euch", "YOUFM Deutschrap ideal", "YOUFM Junge Nacht der ARD"}; + public String getBR3InfoByTime(int x) { + if(x >= 5 && x <9) return BR3Info[0]; + else if (x >= 9 && x < 12) return BR3Info[1]; + else if (x == 12) return BR3Info[2]; + else if (x >= 13 && x < 16) return BR3Info[3]; + else if (x >= 16 && x < 19) return BR3Info[4]; + else if (x >= 19 && x < 21) return BR3Info[5]; + else if (x >= 22 && x <= 23) return BR3Info[5]; + else return BR3Info[6]; + } + + String[] BR3Info = {"Sebastian Winkler und die Frühaufdreher", "BAYERN 3 - und DU mittendrin!", "Update", "Hits, Hits, Hits für euren Nachmittag", "Die Zwei für euren Feierabend", "Was geht?!", "Matuschke - der etwas andere Abend","Die Nacht"}; + public String getAntenneBYInfoByTime(int x) { if(x >= 5 && x <9) return AntenneBYInfo[0]; else if (x >= 9 && x < 12) return AntenneBYInfo[1]; diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index e97d7f9..124e318 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -119,6 +119,18 @@ class RadioPlayerTest { assertThat(rp.getAntenneBYInfoByTime(3)).describedAs("AntenneBY info by Time at 3.00").isEqualTo("ANTENNE BAYERN Hit-Nacht"); } + @Test + void BR3InfoByTimeTest() { + RadioPlayer rp = new RadioPlayer(); + assertThat(rp.getBR3InfoByTime(5)).describedAs("BR3 info by Time at 5.00").isEqualTo("Sebastian Winkler und die Frühaufdreher"); + } + + @Test + void BR3InfoByTime2Test() { + RadioPlayer rp = new RadioPlayer(); + assertThat(rp.getBR3InfoByTime(21)).describedAs("BR3 info by Time at 21.00").isEqualTo("Matuschke - der etwas andere Abend"); + } + /*