Y2S1-Seabed_Explorer/test/strategy_pattern_tests/pHTest.java
2020-06-07 22:14:52 +01:00

39 lines
1.0 KiB
Java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package strategy_pattern_tests;
import static org.junit.Assert.*;
import org.junit.Test;
import seabedexplorer.data.Data;
import seabedexplorer.data.pHReading;
import seabedexplorer.submersible.ROV;
import seabedexplorer.submersible.equipment.waterreadings.PH;
/**
*
* @author Super
*/
public class pHTest {
@Test
public void validpHTest() {
ROV submersible = new ROV();
PH equipment = new PH(submersible);
for (int i = 0; i < 100; i++)
equipment.collectData();
Data[] data = equipment.getData().toArray(new Data[100]);
for (int i = 0; i < 100; i++) {
pHReading current = (pHReading) data[i];
System.out.println(current.getReading());
assertTrue(current.getReading() >= 1 && current.getReading() <= 14);
}
}
}