|
|
@ -0,0 +1,41 @@ |
|
|
|
import device.radioPlayer.RadioPlayer; |
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
import java.io.FileReader; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
class BordComputerTest { |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("readConfigOptions") |
|
|
|
void readConfigTest(String testName, String testTyp, BordComputer testBc) { |
|
|
|
if (testTyp.equals("count")) { |
|
|
|
int count = 0; |
|
|
|
try (FileReader reader = new FileReader("Geraete.config")) { |
|
|
|
Properties properties = new Properties(); |
|
|
|
properties.load(reader); |
|
|
|
count = properties.size(); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
assertThat(count).describedAs(testName).isEqualTo(testBc.deviceNames.length); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static Stream<Arguments> readConfigOptions() { |
|
|
|
BordComputer bc1 = new BordComputer(); |
|
|
|
bc1.readConfig(); |
|
|
|
|
|
|
|
return Stream.of( |
|
|
|
Arguments.of("Check if file reader is getting every item in Geraete.config", "count", bc1) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
} |