How to assert greater than using JUnit Assert?

前端 未结 8 830
你的背包
你的背包 2020-12-25 09:04

I have these values coming from a test

previousTokenValues[1] = \"1378994409108\"
currentTokenValues[1] = \"1378994416509\"

and I try

相关标签:
8条回答
  • 2020-12-25 09:55

    you can also try below simple soln:

    previousTokenValues[1] = "1378994409108";
    currentTokenValues[1] = "1378994416509";
    
    Long prev = Long.parseLong(previousTokenValues[1]);
    Long curr = Long.parseLong(currentTokenValues[1]);
    
    Assert.assertTrue(prev  > curr );   
    
    0 讨论(0)
  • 2020-12-25 09:56

    As I recognize, at the moment, in JUnit, the syntax is like this:

    AssertTrue(Long.parseLong(previousTokenValues[1]) > Long.parseLong(currentTokenValues[1]), "your fail message ");
    

    Means that, the condition is in front of the message.

    0 讨论(0)
提交回复
热议问题