Or else you can follow Installing Java from my article.
Click File > New > Java Project > Enter "JseUnitTesting" as project name > Finish
Right Click on the project > New > Source Folder

From the menu access Project(or simply Right Click on the project) > Properties > Libraries tab > Add External JARs >

junit4.10) from the folder (e.g.: D:\Automation Workspace\lib) > Now we have the junit jar in our build path.
Press OK button
In the Package Explorer tab the new added junit library is displayed under Referenced Libraries:

Create a Java class in the src namely MyClass with package junitSrc

package junitSrc;
public class MyClass {
public int multiply(int x, int y) {
return x / y;
}
}
Create a JUnit test in test namely MyClassTest
Right click on test folder > New > Other... > Java > JUnit > JUnitTestCase >

Next > Finish
Create a test with the following code looking in the figure

package junitTest;
import junitSrc.MyClass;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class MyClassTest {
@Test
public void testMultiply() {
MyClass tester = new MyClass();
assertEquals("Result::", 50, tester.multiply(10, 5));
}
}
Right click on your new test class and select Run-As > JUnit Test.

The result of the tests will be displayed in the JUnit View.

The test should be failing (indicated via a red bar).
This is because our multiplier class is currently not working correctly (it does a division instead of multiplication). Fix the bug and re-run test to get a green bar.
If you have several tests you can combine them into a test suite. Running a test suite will execute all tests in that suite.
To create a test suite, select your test classes > right click on it > New > Other... > JUnit > JUnit Test Suite
Select "Next" and select the methods for which you want to create a test.
Change the code to the following to make your test suite run your test. If you develop another test later you can add it to @Suite.SuiteClasses.
package junitTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({ MyClassTest.class })
public class AllTests {}
You can also run your tests from via your own code. The class org.junit.runner.JUnitCore provides the method runClasses() which allows you to run one or several tests classes. As a return parameter you receive an object of the type org.junit.runner.Result. This object can be used to retrieve information about the tests.
In your "test" folder create a new class MyTestRunner with the following code. This class will execute your test class and write potential failures to the console.
package junitTest;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
public class MyTestRunner {
public static void main(String[] args) {
Result result = JUnitCore.runClasses(MyClassTest.class);
for (Failure failure : result.getFailures()) {
System.out.println(failure.toString());
}
}
}
For more details please go through my post Getting started with Selenium RC (selenium 1) with JUnit 3 or JUnit 4 and more examples.