I am writing a java project , in this project I have Graph class and other classes that represent a graph and points ... ( this is not important for my problem)
I wrote couple of functions that prints a speceific graph name and other basic functions that work on graphs.
I also wrote a function :
private void listNodes(String graphName); this function is supposed to print all of the nodes in the graph that it's name was giving!
after that we ran tests that uses jUnit , these tests basically compare between the the test expected output ( that is giving to us ) , and between the actual output ( the output of the code I wrote)
jUnit always shows me that there is a difference between the expected output of the function private void listNodes(String graphName) and my actuall output !
I looked at both of the outputs and there was no difference at all !!
But then in the window that jUnits shows both of the outputs there was an option to show white space characters When I clicked it showed this : (look at line 16 ( this line shows the output of the private void listNodes(String graphName) function , on the left is the expected output and on the right is my output :( )
Any one know what is this red star shaped space and how to add it in the code ??
this is my function ( that prints line 16) :
private void listNodes(String graphName) {
Graph<WeightedNode> graph = graphs.get(graphName); if(graph==null) return; List<WeightedNode> listOfAllNodes=graph.getNodesList(); Collections.sort(listOfAllNodes); output.print(graphName+" contains:"); for(int i=0;i<listOfAllNodes.size();i++) { output.print("\s"); output.print(listOfAllNodes.get(i).getName()); } output.print("\n"); } https://stackoverflow.com/questions/65516259/what-does-the-star-whitespace-in-java-junit-mean December 31, 2020 at 11:24AM

没有评论:
发表评论