Question: Write a Junit Test for the following method (Java Class) import java.util.*; class Fibonacci { public static int fib(int n) { //If n=0 or n=1

Write a Junit Test for the following method (Java Class)

import java.util.*;

class Fibonacci {

public static int fib(int n) { //If n=0 or n=1 we return 0 and 1 respectively if(n < 2) { return n; } else { //If n>2 calling fin(n-1) and fib(n-2) recursively and adding them return fib(n-1)+fib(n-2); } } }

public class FibonacciTest {

Your code goes here///

(Please use assertEquals for testing)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!