Question
I have the following code and I want to use bufferedreader to compare two files in JUNIT java .i need code for developing JUnit test
I have the following code and I want to use bufferedreader to compare two files in JUNIT java .i need code for developing JUnit test using seed value 20.
To compare two text files in Junit, you can try the following pseudocode. Use BufferedReader to read the input files. BufferedReader Out=new BufferedReader (new FileReader ()); BufferedReader In=new BufferedReader (new FileReader ()); while ((expectedLine = In.readLine ()) != null) { String actualLine = Out.readLine (); assertEquals (expectedLine, actualLine); } Set seed value as 20. Random r=new Random(); r.setSeed(20); Compare the output file with attached see next: if you use double d = random.nextDouble(); int j = (int)(d*arr.length); use Target1.txtPreview the document else if you use else if you use Random r = new Random(0); r.setSeed(20); for (i = n-1 to 0) { int j = r.nextInt(i); swap(arr[i],arr[j]); } use Target2.txtPreview the document *****please correct the code how to compare two files in JUnit . thanks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started