Y2S1-Seabed_Explorer/test/strategy_pattern_tests/SalinityTest.java

39 lines
1.1 KiB
Java
Raw Normal View History

2020-06-07 21:14:52 +00:00
/*
* 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.SalinityReading;
import seabedexplorer.submersible.ROV;
import seabedexplorer.submersible.equipment.waterreadings.Salinity;
/**
*
* @author Super
*/
public class SalinityTest {
@Test
public void validSalinityTest() {
ROV submersible = new ROV();
Salinity equipment = new Salinity(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++) {
SalinityReading current = (SalinityReading) data[i];
System.out.println(current.getReading());
assertTrue(current.getReading() >= 0 && current.getReading() <= 1000);
}
}
}