简体   繁体   中英

Testing Spring boot application, Entity mocking

i need to test this method, could you please help me, i dont know if i need mock TransferEntity data or what to do. Thanks in advance

public static void setStatus(TransferEntity entity, String Status){

... }

I think it depends the first things coming to minds.

  • Which library are you for unit testing? What is the content of your method?

  • Are you calling another method from you method?

  • Do you want to perform integration test over your entity?

    If yes, you would configure database for test scope.

  • Why you are using static method to set your entity?

In conclusion, please share more detail by sharing code block etc

are you performing unit testing on this method by directly calling it? if yes then you can mock TransferEntity and use when(...).thenReturn(...) kind of snippet. but your question is very generic so difficult to answer concretely.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM