-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38db5b9
commit 0e67484
Showing
4 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...ava/de/fraunhofer/fokus/OpenMobileNetworkToolkit/DataProvider/BatteryInformationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Peter Hasse <[email protected]> | ||
* SPDX-FileCopyrightText: 2023 Johann Hackler <[email protected]> | ||
* SPDX-FileCopyrightText: 2023 Fraunhofer FOKUS | ||
* | ||
* SPDX-License-Identifier: apache2 | ||
*/ | ||
|
||
package de.fraunhofer.fokus.OpenMobileNetworkToolkit.DataProvider; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class BatteryInformationTest { | ||
|
||
private BatteryInformation batteryInformation; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
batteryInformation = new BatteryInformation(); | ||
|
||
} | ||
@Test | ||
public void getScale() { | ||
assertEquals( "Should return null", 0, batteryInformation.getScale()); | ||
batteryInformation.setScale(10); | ||
assertEquals( "Should return 10", 10, batteryInformation.getScale()); | ||
} | ||
|
||
@Test | ||
public void setScale() { | ||
batteryInformation.setScale(10); | ||
assertEquals( "Should return 10", 10, batteryInformation.getScale()); | ||
} | ||
|
||
@Test | ||
public void getLevel() { | ||
assertEquals("Should return 0", 0, batteryInformation.getLevel()); | ||
batteryInformation.setLevel(10); | ||
assertEquals("Should return 10", 10, batteryInformation.getLevel()); | ||
} | ||
|
||
@Test | ||
public void setLevel() { | ||
batteryInformation.setLevel(10); | ||
assertEquals("Should return 10", 10, batteryInformation.getLevel()); | ||
} | ||
|
||
@Test | ||
public void getCharge_type() { | ||
assertEquals("Should return 0", 0, batteryInformation.getCharge_type()); | ||
batteryInformation.setCharge_type(10); | ||
assertEquals("Should return 10", 10, batteryInformation.getCharge_type()); | ||
} | ||
|
||
@Test | ||
public void setCharge_type() { | ||
batteryInformation.setCharge_type(10); | ||
assertEquals("Should return 10", 10, batteryInformation.getCharge_type()); | ||
} | ||
|
||
@Test | ||
public void getPercent() { | ||
assertEquals("Should return NaN", Double.NaN, batteryInformation.getPercent(),0.0); | ||
batteryInformation.setScale(10); | ||
batteryInformation.setLevel(10); | ||
assertEquals("Should return 100.0", 100.0, batteryInformation.getPercent(),0.0); | ||
} | ||
|
||
} |