<repo_name>mishraak/cmpe273_refresher_Assignment<file_sep>/javademos/src/test/java/com/cmpe273/assignment1/javademos/GenericTest.java
package com.cmpe273.assignment1.javademos;

import org.junit.Before;
import org.junit.Test;

import junit.framework.Assert;

public class GenericTest{
	
	public GenericDemo<?> gd1, gd2;
	
	@Before
	public void initStringGeneric(){
		gd1 = new GenericDemo<String>("genDemo");
		gd2 = new GenericDemo<Integer>(5);
	}
	
	@Test
	public void testPrintGeneric(){
		Assert.assertEquals("genDemo", gd1.printArray());
		Assert.assertEquals("5", gd2.printArray());
	}
	
}
<file_sep>/javademos/src/main/java/com/cmpe273/assignment1/javademos/MultithreadingDemo.java
package com.cmpe273.assignment1.javademos;

public class MultithreadingDemo {
	
    public int count=100;
    public int decrementCount()
    {
        count--;
        return count;
    }   
}<file_sep>/javademos/src/test/java/com/cmpe273/assignment1/javademos/QueueTest.java
package com.cmpe273.assignment1.javademos;
import org.junit.Before;
import org.junit.Test;
import junit.framework.Assert;

public class QueueTest {	
	
	
	@Before
	public void initQueue(){
		QueueDemo.setupQueue();
	}
	@Test
	public void testQueue(){
		Assert.assertEquals(QueueDemo.demoQueue(), "m1 m2 m3 ");
	}			
}

<file_sep>/javademos/src/main/java/com/cmpe273/assignment1/javademos/CollectionDemo.java
package com.cmpe273.assignment1.javademos;

import java.util.Hashtable;

public class CollectionDemo {
	public Hashtable<Integer, String> ht;
	
	
	public CollectionDemo(){
		ht=new Hashtable<Integer, String>();
	}
	
	public int initHashMap(){		
		ht.put(0, "Zero");
		ht.put(1, "One");
		return ht.size();
	}
	
	public String updateRecord(int i, String s){
		ht.put(i, s);
		return ht.get(i);
	}
	
	public int deleteRecord(int i){
		ht.remove(i);
		return ht.size();
	}
	
}	
<file_sep>/javademos/src/test/java/com/cmpe273/assignment1/javademos/ArrayTest.java
package com.cmpe273.assignment1.javademos;
import org.junit.Before;
import org.junit.Test;
import junit.framework.Assert;

public class ArrayTest {
	
	
	@Before
	public void testInitArray(){
		ArrayDemo.initArray();
	}
	
	@Test
	public void testPrintArray(){
		Assert.assertEquals(ArrayDemo.demoArray(), "0 1 4 9 16 ");
	}
	
	@Test
	public void testAddToArray(){
		Assert.assertEquals(6, ArrayDemo.addToArray(25));
	}
	
	
}
<file_sep>/javademos/src/main/java/com/cmpe273/assignment1/javademos/Animal.java
package com.cmpe273.assignment1.javademos;

public interface Animal {
	public String makeNoise();
	public String callKid();
}

<file_sep>/javademos/src/test/java/com/cmpe273/assignment1/javademos/InterfaceTest.java
package com.cmpe273.assignment1.javademos;

import org.junit.Before;
import org.junit.Test;

import junit.framework.Assert;

public class InterfaceTest {
	public static Animal dog, cat;
	
	@Before
	public void testInit(){
		 dog = new Dog();
		 cat = new Cat();		
	}
	
	@Test
	public void testCatNoise(){
		Assert.assertEquals("Meow Meow!!!", cat.makeNoise());
	}
	
	@Test
	public void testDogNoise(){
		Assert.assertEquals("Whoo whoo!!!", dog.makeNoise());
	}
	
	@Test
	public void testCatCallKid(){
		Assert.assertEquals("hey kitten!!!", cat.callKid());
	}
	
	@Test
	public void testDogCallKid(){
		Assert.assertEquals("hey puppy!!!", dog.callKid());
	}
	
}
