Lecture 4
JUnit�Compilation Steps
Some slides were borrowed from Josh Hug and Adam Jundt
Testing
Black-box Testing
Clear-box Testing (asa “white-box testing”)
Why bother?? http://stackoverflow.com/questions/10858990/why-use-junit-for-testing
Unit (micro)-testing
Test-Driven Development (TDD)
Steps to developing according to TDD:
�Not required but testing is always needed. �
Problem to solve.
Idea?
Did everything make sense?
A: Yes
B: Almost, need to practice now
C: More or less, need to review (and then practice)
D: Mostly lost
E: Completely lost
@BeforeEach, @AfterEach, @beforeAll
Compilation
(demo)
Why bother with class file?
Why make a class file at all?
public class CarLauncher {
public static void main(String[] args) {
Car audi;
new Car(40);
audi = new Car(50);
Car honda = new Car(4);
audi.blowUp();
honda.blowUp();
}
} //Link
class Car {
int speed;
public Car(int sp){
speed = sp;
}
public void blowUp() { System.out.println("baaaam!: " + speed);
}
}