This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SamochodTest.java
48 lines (41 loc) · 1.8 KB
/
SamochodTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package auto;
import org.junit.Test;
import static org.junit.Assert.*;
public class SamochodTest {
@Test
public void obliczWage() {
Samochod samochod = new Samochod("skrzynia",5000,4000,7,"sprzeglo",
3555,3876,"silnik",6890,14000,8000,
"czerwony","979","camaro","porshe",320);
System.out.println("test1:");
float weight = samochod.obliczWage();
assertEquals(15445,weight,0.1); // tworzę obiekt samochód i liczę wagę elementów
}
@Test
public void aktualnaPredkosc() {
}
@Test
public void wlacz() {
Samochod samochod = new Samochod("skrzynia",5000,4000,7,"sprzeglo",
3555,3876,"silnik",6890,14000,8000,
"czerwony","979","camaro","porshe",320);
System.out.println("test1:");
String msg = samochod.wlacz();
assertTrue("włączenie samochodu nie działa","Silnik uruchomiony".equals(msg)); // właczam wyłączony samochód
System.out.println("test2:");
msg = samochod.wlacz();
assertFalse("włączenie samochodu działa, a nie powinno","Silnik uruchomiony".equals(msg)); // właczam włączony samochód
}
@Test
public void wylacz() {
Samochod samochod = new Samochod("skrzynia",5000,4000,7,"sprzeglo",
3555,3876,"silnik",6890,14000,8000,
"czerwony","979","camaro","porshe",320);
System.out.println("test1:");
String msg = samochod.wlacz();
assertTrue("włączenie samochodu działa","Silnik uruchomiony".equals(msg)); // wyłączam włączony samochód
System.out.println("test2:");
msg = samochod.wylacz();
assertFalse("Włączenie samochodu działa, a nie powinno","Silnik uruchomiony".equals(msg)); // wyłączam wyłączony samochód
}
}