Java junit.framework.AssertionFailedError,由于空白,没有可运行的方法

Java junit.framework.AssertionFailedError,由于空白,没有可运行的方法,java,unit-testing,junit,whitespace,assert,Java,Unit Testing,Junit,Whitespace,Assert,执行此操作时,我会收到junit.framework.AssertionFailedError: assertEquals("123 \t July \t testuser \t USD \t one two \t pnl \t ACTUALS_STAGE \t product_line \t pnl", tabs ); 错误: expected:<123[ July testuser USD one two pnl ACTUALS_STAGE

执行此操作时,我会收到junit.framework.AssertionFailedError:

assertEquals("123 \t July \t testuser \t USD \t one two \t pnl \t ACTUALS_STAGE \t product_line \t pnl", tabs );
错误:

expected:<123[   July    testuser    USD     one two     pnl     ACTUALS_STAGE   product_line    ]pnl>
but was:<123[   July    testuser    USD one two pnl ACTUALS_STAGE   product_line    ]pnl>
我已经用@Test注释了它,如果我使用“abc\t pqr”,它就会工作

我还尝试过执行“abc”+“\t”“pqr”,但它给出了相同的runnable not found(初始化错误)


如何处理此问题以修复断言错误和可运行错误?我只希望在值之间有一个空格。

您真的需要检查空格和空格吗? 如果没有,则将字符串结果传递给一个新方法,该方法将修复间距问题。 或者您可以简单地返回一个值数组,忽略空格,如下所示

public static String[] getValues(String input){
  //tokenize 
  String[] values = input.split("\\s+");  
  return values;    

}

然后,您可以使用断言来比较预期和实际的数组

添加测试方法的相关部分。@Darrenforsyth-编辑了问题!第二个问题,你真的在乎空白,还是仅仅是对测试数据的烦扰?
No runnable method found.
public static String[] getValues(String input){
  //tokenize 
  String[] values = input.split("\\s+");  
  return values;    

}