diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..6668c41
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+typeinformation
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..aef09a0
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..1c24f9a
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_12.xml b/.idea/libraries/Maven__junit_junit_4_12.xml
new file mode 100644
index 0000000..d411041
--- /dev/null
+++ b/.idea/libraries/Maven__junit_junit_4_12.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
new file mode 100644
index 0000000..f58bbc1
--- /dev/null
+++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..b2aa25a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..42e27ba
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..e4b497f
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,30 @@
+
+ 4.0.0
+ com.zipocde.app
+ typeinformation
+ jar
+ 1.0-SNAPSHOT
+ typeinformation-lab
+ http://maven.apache.org
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/Result.java b/src/main/java/Result.java
new file mode 100644
index 0000000..89b32c8
--- /dev/null
+++ b/src/main/java/Result.java
@@ -0,0 +1,34 @@
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public class Result {
+ private String failureTestDetails;
+
+ private String successTestsDetails;
+
+ public String getSuccessTestsDetails() {
+ return successTestsDetails;
+ }
+
+ public void setSuccessTestsDetails(String successTestsDetails) {
+ this.successTestsDetails = successTestsDetails;
+ }
+
+ public String getFailureTestDetails() {
+ return failureTestDetails;
+ }
+
+ public void setFailureTestDetails(String failureTestDetails) {
+ this.failureTestDetails = failureTestDetails;
+ }
+
+ @Override
+ public String toString() {
+ if (failureTestDetails != null) {
+ return failureTestDetails ;
+ } else {
+ return successTestsDetails;
+ }
+
+ }
+}
diff --git a/src/main/java/UnitCornTestRunner.java b/src/main/java/UnitCornTestRunner.java
new file mode 100644
index 0000000..7b76b38
--- /dev/null
+++ b/src/main/java/UnitCornTestRunner.java
@@ -0,0 +1,35 @@
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public class UnitCornTestRunner {
+
+ public Result runTest(Class c, Method methodName) {
+ Result result = new Result();
+
+ try{
+ methodName.invoke(c.newInstance());
+ result.setSuccessTestsDetails("Test on method "+ methodName + " passed");
+ } catch (Throwable t){
+ result.setFailureTestDetails("Test on method "+ methodName + " failed" + " cause: "+ t.getCause().getMessage());
+ }
+
+ return result;
+ }
+
+ public String runTests(Class c) {
+ Method[] methods = c.getDeclaredMethods();
+ StringBuilder sb = new StringBuilder();
+ for (Method method : methods) {
+ if (method.isAnnotationPresent(Test.class)) {
+ Result testResultReport = runTest(c, method);
+ sb.append(testResultReport.toString());
+ }
+ }
+ return sb.toString();
+ }
+}
+
diff --git a/src/main/java/com/zipcode/typeinformation/ReflectionClass.java b/src/main/java/com/zipcode/typeinformation/ReflectionClass.java
new file mode 100644
index 0000000..a90aba9
--- /dev/null
+++ b/src/main/java/com/zipcode/typeinformation/ReflectionClass.java
@@ -0,0 +1,65 @@
+package com.zipcode.typeinformation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
+
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public class ReflectionClass {
+
+
+ public Boolean classImplementsInterface(Object object, String interfaceName) {
+ Class>[] interfaces = object.getClass().getInterfaces();
+
+ for (Class> interfaceType : interfaces) {
+ if (interfaceType.getName().equals(interfaceName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public String listAllMembers(Object object) {
+
+ Field[] fields = object.getClass().getFields();
+ StringBuilder sb = new StringBuilder();
+
+ for (Field field : fields) {
+ sb.append("Field Name :" + field.getName() + " Declared class Name : " + field.getDeclaringClass().getName() + " Field modifier :" + field.getDeclaringClass().getModifiers() + "\n");
+ }
+
+ Constructor>[] constructors = object.getClass().getConstructors();
+
+ for (Constructor constructor : constructors) {
+ sb.append("Constructor Name :" + constructor.getName() + "\n");
+ }
+
+
+ Method[] methods = object.getClass().getDeclaredMethods();
+ for (Method method : methods) {
+ sb.append("Method Name :" + method.getName() + "\n");
+ }
+
+ return sb.toString();
+ }
+
+ public String getClassHierarchy(Object object) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(object.getClass().getName() );
+ Class> superclass = object.getClass().getSuperclass();
+ while (superclass != null) {
+ sb.append("\n"+superclass.getName());
+ superclass = superclass.getSuperclass();
+
+ }
+ return sb.toString();
+ }
+
+
+
+}
diff --git a/src/test/java/UnitCornTestRunnerTest.java b/src/test/java/UnitCornTestRunnerTest.java
new file mode 100644
index 0000000..ab8fc08
--- /dev/null
+++ b/src/test/java/UnitCornTestRunnerTest.java
@@ -0,0 +1,22 @@
+import com.zipcode.typeinformation.DummyTestClass;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public class UnitCornTestRunnerTest {
+ @Test
+ public void runTests() throws Exception {
+ //Given
+ UnitCornTestRunner unitCornTestRunner = new UnitCornTestRunner();
+
+ //when
+ String result = unitCornTestRunner.runTests(DummyTestClass.class);
+
+ //then
+ assertNotNull(result);
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/zipcode/typeinformation/Dog.java b/src/test/java/com/zipcode/typeinformation/Dog.java
new file mode 100644
index 0000000..6b8d086
--- /dev/null
+++ b/src/test/java/com/zipcode/typeinformation/Dog.java
@@ -0,0 +1,16 @@
+package com.zipcode.typeinformation;
+
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public class Dog implements Pet {
+ public String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/src/test/java/com/zipcode/typeinformation/DummyTestClass.java b/src/test/java/com/zipcode/typeinformation/DummyTestClass.java
new file mode 100644
index 0000000..2b281b6
--- /dev/null
+++ b/src/test/java/com/zipcode/typeinformation/DummyTestClass.java
@@ -0,0 +1,22 @@
+package com.zipcode.typeinformation;
+
+import org.junit.Test;
+
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public class DummyTestClass {
+
+ @Test
+ public void allwaysSuccessMethod() {
+ System.out.println("this method will always be successful");
+ }
+
+ @Test
+ public void allwaysFailMethod() throws Exception {
+ System.out.println("this method will always throw exception ");
+ throw new Exception();
+ }
+}
+
+
diff --git a/src/test/java/com/zipcode/typeinformation/Pet.java b/src/test/java/com/zipcode/typeinformation/Pet.java
new file mode 100644
index 0000000..617e200
--- /dev/null
+++ b/src/test/java/com/zipcode/typeinformation/Pet.java
@@ -0,0 +1,8 @@
+package com.zipcode.typeinformation;
+
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public interface Pet {
+
+}
diff --git a/src/test/java/com/zipcode/typeinformation/ReflectionClassTest.java b/src/test/java/com/zipcode/typeinformation/ReflectionClassTest.java
new file mode 100644
index 0000000..2d04618
--- /dev/null
+++ b/src/test/java/com/zipcode/typeinformation/ReflectionClassTest.java
@@ -0,0 +1,79 @@
+package com.zipcode.typeinformation;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public class ReflectionClassTest {
+ @Test
+ public void getClassHierarchy() throws Exception {
+ //given
+
+ ReflectionClass reflectionClass = new ReflectionClass();
+ Object alist = new ArrayList();
+
+ //when
+ String result = reflectionClass.getClassHierarchy(alist);
+ //then
+ String exptected ="java.util.ArrayList\n" +
+ "java.util.AbstractList\n" +
+ "java.util.AbstractCollection\n" +
+ "java.lang.Object";
+ assertEquals(exptected ,result) ;
+
+
+ }
+
+ @Test
+ public void listAllMembers() throws Exception {
+ //given
+
+ ReflectionClass reflectionClass = new ReflectionClass();
+ Dog dog = new Dog();
+ //when
+ String result = reflectionClass.listAllMembers(dog);
+
+
+ String exptected ="Field Name :name Declared class Name : com.zipcode.typeinformation.Dog Field modifier :1\n" +
+ "Constructor Name :com.zipcode.typeinformation.Dog\n" +
+ "Method Name :getName\n" +
+ "Method Name :setName\n";
+ //then
+ assertEquals(exptected,result);
+
+ }
+
+ @Test
+ public void classImplementsInterfacePositiveCondition() throws Exception {
+ //given
+
+ ReflectionClass reflectionClass = new ReflectionClass();
+ Dog dog = new Dog();
+ //when
+ Boolean result = reflectionClass.classImplementsInterface(dog, "com.zipcode.typeinformation.Pet");
+
+
+ //then
+ assertTrue(result);
+ }
+ @Test
+ public void classImplementsInterfaceNegative() throws Exception {
+ //given
+
+ ReflectionClass reflectionClass = new ReflectionClass();
+ Dog dog = new Dog();
+ //when
+ Boolean result = reflectionClass.classImplementsInterface(dog, "com.zipcode.typeinformation.Vehicle");
+
+
+ //then
+ assertFalse(result);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/zipcode/typeinformation/Vehicle.java b/src/test/java/com/zipcode/typeinformation/Vehicle.java
new file mode 100644
index 0000000..9defb5b
--- /dev/null
+++ b/src/test/java/com/zipcode/typeinformation/Vehicle.java
@@ -0,0 +1,7 @@
+package com.zipcode.typeinformation;
+
+/**
+ * Created by vidyachandasekhar on 5/7/17.
+ */
+public interface Vehicle {
+}
diff --git a/typeinformation.iml b/typeinformation.iml
new file mode 100644
index 0000000..4e3316b
--- /dev/null
+++ b/typeinformation.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file