Kaynağa Gözat

Two test cases and suite testing event attributes work when added to list.

Fernando Diaz 9 yıl önce
ebeveyn
işleme
f6be3344a4

+ 37 - 0
app/src/test/java/com/example/yiupang/freefoodfinder/TestAddToEventListDescription.java

@@ -0,0 +1,37 @@
+package com.example.yiupang.freefoodfinder;
+
+/**
+ * Created by Fernando on 6/6/17.
+ */
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import java.util.ArrayList;
+
+import static org.junit.Assert.assertEquals;
+
+
+public class TestAddToEventListDescription
+{
+
+    @Test
+    public void addToEventListDescriptionTest() {
+        ArrayList<Event> myEventsArray = new ArrayList<Event>();
+
+        Event google = new Event("Google Networking Session", "A Pizza",
+                "We're hiring");
+        google.setPlace("14");
+        google.setDate("2017-06-21");
+        google.setDescription("Come find out how to be a googler!");
+
+        myEventsArray.add(google);
+
+        String expected = "Come find out how to be a googler!";
+        String actual = myEventsArray.get(0).getDescription();
+
+        Assert.assertEquals(expected, actual);
+    }
+
+
+}

+ 33 - 0
app/src/test/java/com/example/yiupang/freefoodfinder/TestAddToEventListPlace.java

@@ -0,0 +1,33 @@
+package com.example.yiupang.freefoodfinder;
+
+/**
+ * Created by Fernando on 6/6/17.
+ */
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import java.util.ArrayList;
+
+import static org.junit.Assert.assertEquals;
+
+
+public class TestAddToEventListPlace
+{
+    @Test
+    public void addToEventListPlaceTest() {
+        ArrayList<Event> myEventsArray = new ArrayList<Event>();
+
+        Event google = new Event("Google Networking Session", "A Pizza",
+                "We're hiring");
+        google.setPlace("14");
+        google.setDate("2017-06-21");
+
+        myEventsArray.add(google);
+
+        String expected = "14";
+        String actual = myEventsArray.get(0).getPlace();
+
+        Assert.assertEquals(expected, actual);
+    }
+}

+ 14 - 0
app/src/test/java/com/example/yiupang/freefoodfinder/TestEventListSuite2.java

@@ -0,0 +1,14 @@
+package com.example.yiupang.freefoodfinder;
+
+/**
+ * Created by Fernando on 6/6/17.
+ */
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({TestAddToEventListPlace.class, TestAddToEventListDescription.class})
+
+public class TestEventListSuite2
+{
+}