I have the following piece of code which has time factor in it. I have trouble thinking how to do unit test for this piece of code.
public void someMethod(MultipartFile file,String username){
long timeNow = System.currentTimeMillis();
byte[] bytes = file.getBytes();
String fileLocation = defaultLocation +username+"_picture_"+timeNow+"_"+file.getOriginalFilename();
Path path = Paths.get(fileLocation);
Files.write(path, bytes);
}
Since there is time involved i am unable to do unit testing. Can anyone please help in this? I use Mockito for unit testing btw
Aucun commentaire:
Enregistrer un commentaire