dimanche 31 juillet 2016

How to check the coming output from main method?

By example, having the next main code:

public class Solution {
   public static void main(String []argv)   {
       System.out.println("Hello World.");
       System.out.println("Hello Java.");
   }
}

I whan to know how code plataform(By example: Hackerrank) check that main method is printing the expected output.

Hello World.
Hello Java.

Is not easy imagine how to do it with Junit, at first sight. I believe that an external program is checking the output, I mean something like this:

$ java Solution | runtests

From already thank you very much.

Aucun commentaire:

Enregistrer un commentaire