Posts

Showing posts from June, 2015

JUNIT TEST Case Sample for fresher

This is basic test case created using JUNIT. Which will give you basic understanding of Junit testcase . /**  *  */ package test; /**  * @author PraveenKumar  *  */ public class JunitTest { public boolean validatePositivenonZero(int a, int b){ if(a > 0 && b > 0){ return false; } return true; } public int add(int a , int b){ return a+b; } public int multiply(int a, int b){ return a*b ; } public double add(double a, double b){ return a+b; } } /**  *   */ package com.junit.testcase.test; import static org.junit.Assert.*; import junit.framework.Assert; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import test.JunitTest; /**  * @author PraveenKumar  *  */ public class UnitTestCase { private int a; private int b; /** * @throws java.lang.Exception ...

HashMap implementation

How to implement the hashmap without using HashMap class from java collection util package. This is one of the interview question asked from JP Morgan I haven't answer in the following way but i have tried to explain in Datastructure. It would help someone like me .. :) enjoy this can be enhance in more but to make it simple .. import java.util.ArrayList; import java.util.Arrays; import java.util.List; /**  *  */ /**  * @author PraveenKumar  *  */ public class HashMapDS {  /**   * @param args   */  public static void main(String[] args) {     HashMap map=new HashMap();   for(int i=0;i    map.put("a"+i, i+10);   }   System.out.println(""+map.get("a1")+25);   map.display(map);  } } import java.util.ArrayList; import java.util.List; /**  *  */ /**  * @author PraveenKumar  *  */ public class HashMap { ...