File tree Expand file tree Collapse file tree
unit-testing/chapter-example/car-example/src/test/java/org/launchcode Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .launchcode ;
22
3- import static org .junit .jupiter .api .Assertions .*;
3+ import org .junit .jupiter .api .BeforeEach ;
4+ import org .junit .jupiter .api .Test ;
5+ import static org .junit .jupiter .api .Assertions .assertEquals ;
46
57class CarTest {
8+ Car test_car ; // Declare the Car object here
9+
10+ @ BeforeEach
11+ public void createCarObject () {
12+ // Initialize the Car object before each test
13+ test_car = new Car ("Toyota" , "Prius" , 10 , 50 );
14+ }
15+
616 //TODO: add emptyTest so we can configure our runtime environment (remove this test before pushing to your personal GitLab account)
17+ @ Test
18+ public void emptyTest () {
19+ assertEquals (10 , 10 , .001 );
20+ }
21+
722 //TODO: constructor sets gasTankLevel properly
23+ @ Test
24+ public void testInitialGasTank () {
25+ assertEquals (10 , test_car .getGasTankLevel (), .001 );
26+ }
27+
828 //TODO: gasTankLevel is accurate after driving within tank range
929 //TODO: gasTankLevel is accurate after attempting to drive past tank range
1030 //TODO: can't have more gas than tank size, expect an exception
You can’t perform that action at this time.
0 commit comments