Tests should not test how something is implemented, they should be testing behavior.
This test is testing implementation more than specification - speedFactor is an implementation detail. A better test would be turboOn, gas, move, check new position.
You should never repeat the implementation code inside of a test, so if you find yourself looking at how something is implemented in order to write the test - you're writing the test wrong! Here you're using the exact implementation of speedFactor inside Volvo240 in order to test it, which is wrong.
Tests should not test how something is implemented, they should be testing behavior.
This test is testing implementation more than specification - speedFactor is an implementation detail. A better test would be turboOn, gas, move, check new position.
https://github.com/ghazalghorabi/TDA553-lab1/blob/9064245501fc0d8910804f850959c9b46f31d00c/test/CarTest.java#L45-L53
You should never repeat the implementation code inside of a test, so if you find yourself looking at how something is implemented in order to write the test - you're writing the test wrong! Here you're using the exact implementation of speedFactor inside Volvo240 in order to test it, which is wrong.