All things are lawful, but not all things are profitable.
Matan Bar Lev wrote:
What am I doing wrong?
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Steve
All things are lawful, but not all things are profitable.
Steve
Steve
Steve
Awesome, glad you got it worked outMatan Bar Lev wrote:Thanks for your answers.
I succeeded to find out what the problem was in my code.
At the very beginning of ShapeDimensionCalculator.java, I wrote the line:
I changed it to
and it works fine.
I have two more questions:
1. After getting to know JUnit, it seems that it is not so comfortable to use. I mean, you have some knowlegde about how your code is built/written in order to use it.
It's not like manual test that you don't have to know anything about your code, just inserting the input and wait for the correct output.
Is there any possibility to make tests without getting into the code with JUnit?
2. I saw that once I operate the JUnit test, and the program creates the object named "tester", the program doesn't commit println commands. My question is how the code knows that it doesn't have to commit "println"s?
What other commands are not supposed to be committed when using JUnit?
Steve
As far as I can tell, that isn't true. If I put System.out.println()s (a.k.a. SOP) in the code that gets called, they are output properly. I suspect one of following things:
1) You think that the menu system should be displayed, because it always is when you run the main() method. But your tests don't call the getShapesFromUser() method, so the menu doesn't get displayed
Steve
Matan Bar Lev wrote:I found out that once I remove the line:
from "ShapeDimensionCalculatorTest" class, the program runs properly, and SOPs are committed. In addition, the test method actually waits for a user stdio input and doesn't commit the line:
I can see the menu in the console window.
Steve
All things are lawful, but not all things are profitable.
Matan Bar Lev wrote:So the question is WHY when we run a JUnit test and create a new ShapeDimensionCalculator object, the main method is not committed?
When we just create a ShapeDimensionCalculator object as a part of a program (without @test), the program automatically go to the main method. Why doesn't it happen when we run a test?
Steve
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |