@Test(expected = IllegalArgumentException.class)
 public void restrictInput_overOneSolarPanelEfficiency() {
   ElectricityCalculator calculator = new ElectricityCalculator();
   calculator.getElectricityProduction(100.0, 0.8, 1.2, 100.0, 4.0, 1.0);
 }
 @Test
 public void restrictInput_oneSolarPanelEfficiency() {
   ElectricityCalculator calculator = new ElectricityCalculator();
   assertEquals(
       256.0, calculator.getElectricityProduction(100.0, 0.8, 1.0, 100.0, 4.0, 1.0), 0.01);
 }
 @Test
 public void restrictInput_zeroinverterEfficiency() {
   ElectricityCalculator calculator = new ElectricityCalculator();
   assertEquals(0.0, calculator.getElectricityProduction(100.0, 0.0, 0.7, 100.0, 4.0, 1.0), 0.01);
 }
 @Test
 public void restrictInput_normalinverterEfficiency() {
   double electricity = calculator.getElectricityProduction(100.0, 0.8, 0.7, 120.0, 4.0, 1.0);
   assertEquals(256, electricity, 0.01);
 }
 @Test
 public void restrictInput_normalDailySun() {
   double electricity = calculator.getElectricityProduction(100.0, 0.8, 0.7, 120.0, 4.0, 1.0);
   assertEquals(256.0, electricity, 0.01);
 }
 @Test(expected = IllegalArgumentException.class)
 public void restrictInput_negativeinverterEfficiency() {
   ElectricityCalculator calculator = new ElectricityCalculator();
   calculator.getElectricityProduction(100.0, -0.8, 0.7, 100.0, 4.0, 1.0);
 }
 @Test(expected = IllegalArgumentException.class)
 public void restrictInput_negativeDailySun() {
   ElectricityCalculator calculator = new ElectricityCalculator();
   calculator.getElectricityProduction(-100.0, 0.8, 0.7, 100.0, 4.0, 1.0);
 }
 @Test
 public void restrictInput_zeroDailySun() {
   ElectricityCalculator calculator = new ElectricityCalculator();
   assertEquals(0.0, calculator.getElectricityProduction(0.0, 0.8, 0.7, 100.0, 4.0, 1.0), 0.01);
 }
 @Test
 public void getElectricityProduction_solarSunPowerEqual() {
   double electricity = calculator.getElectricityProduction(100.0, 0.8, 0.7, 100.0, 4.0, 1.0);
   assertEquals(256.0, electricity, 0.01);
 }
Exemplo n.º 10
0
 @Test
 public void getElectricityProduction_solarPanelOver() {
   double electricity = calculator.getElectricityProduction(120.0, 0.8, 0.7, 100.0, 4.0, 1.0);
   assertEquals(307.20, electricity, 0.01);
 }
Exemplo n.º 11
0
 @Test
 public void getElectricityProduction_sunPowerOver() {
   double electricity = calculator.getElectricityProduction(100.0, 0.8, 0.7, 120.0, 4.0, 1.0);
   // System.out.println(electricity);
   assertEquals(256.0, electricity, 0.01);
 }
Exemplo n.º 12
0
 @Test
 public void restrictInput_zeroTimespan() {
   ElectricityCalculator calculator = new ElectricityCalculator();
   assertEquals(0.0, calculator.getElectricityProduction(100.0, 0.8, 0.7, 0.0, 0.0, 0.0), 0.01);
 }
Exemplo n.º 13
0
 @Test
 public void restrictInput_zeroSolarPowerOutput() {
   ElectricityCalculator calculator = new ElectricityCalculator();
   assertEquals(0.0, calculator.getElectricityProduction(100.0, 0.8, 0.7, 0.0, 4.0, 1.0), 0.01);
 }