diff --git a/src/main/java/nyc/c4q/AbstractAwesomeClass.java b/src/main/java/nyc/c4q/AbstractAwesomeClass.java
index e3f9c21..fdd7412 100644
--- a/src/main/java/nyc/c4q/AbstractAwesomeClass.java
+++ b/src/main/java/nyc/c4q/AbstractAwesomeClass.java
@@ -3,15 +3,18 @@
/**
* Created by amyquispe on 5/19/15.
*/
-public abstract class AbstractAwesomeClass implements AwesomeInterface {
+public abstract class AbstractAwesomeClass implements AwesomeInterface{
- @Override
- public int getData() {
- return 0;
- }
+ private int someData = 4;
@Override
public void setData(int someData) {
+ this.someData = someData;
}
+
+ @Override
+ public int getData() {
+ return someData;
+ }
}
diff --git a/src/main/java/nyc/c4q/AwesomeContainer.java b/src/main/java/nyc/c4q/AwesomeContainer.java
index 64e9fd9..71cfa71 100644
--- a/src/main/java/nyc/c4q/AwesomeContainer.java
+++ b/src/main/java/nyc/c4q/AwesomeContainer.java
@@ -1,18 +1,20 @@
package nyc.c4q;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
/**
* Created by amyquispe on 5/19/15.
*/
public class AwesomeContainer {
public static Collection createAwesomeContainer(){
+
return null;
+
}
public static void addAwesomeObject(Collection awesomeContainer){
return;
}
+
+ Collection myList = AwesomeContainer.createAwesomeContainer();
}
diff --git a/src/main/java/nyc/c4q/ConcreteAwesomeClass.java b/src/main/java/nyc/c4q/ConcreteAwesomeClass.java
index f39acca..ad24ab0 100644
--- a/src/main/java/nyc/c4q/ConcreteAwesomeClass.java
+++ b/src/main/java/nyc/c4q/ConcreteAwesomeClass.java
@@ -3,9 +3,21 @@
/**
* Created by amyquispe on 5/19/15.
*/
-public class ConcreteAwesomeClass extends AbstractAwesomeClass {
+public class ConcreteAwesomeClass extends AbstractAwesomeClass {
public ConcreteAwesomeClass(){
}
public ConcreteAwesomeClass(int startData){
}
+
+ @Override
+ public int getData() {
+ return 0;
+ }
+
+ @Override
+ public void setData(int someData) {
+
+ }
+
+
}
diff --git a/src/main/java/nyc/c4q/InitialActivity.java b/src/main/java/nyc/c4q/InitialActivity.java
index 2213b83..3d1a445 100644
--- a/src/main/java/nyc/c4q/InitialActivity.java
+++ b/src/main/java/nyc/c4q/InitialActivity.java
@@ -2,6 +2,7 @@
import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
@@ -29,10 +30,56 @@ public void saveState(){
editor.commit();
}
- @Override
+ @Override
+ protected void onResume() {
+ super.onResume();
+ loadState();
+ }
+
+ @Override
+ protected void onRestart() {
+ super.onRestart();
+ loadState();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ saveState();
+ }
+
+ @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_initial);
preferences = getPreferences(Context.MODE_PRIVATE);
+
+ Button plus = (Button) findViewById(R.id.buttonPlus);
+ plus.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ TextView tvCounter = (TextView) findViewById(R.id.tvCounter);
+ counter += 1;
+ tvCounter.setText(String.valueOf(counter));
+ }
+ });
+ Button minus = (Button) findViewById(R.id.buttonMinus);
+ minus.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ TextView tvCounter = (TextView) findViewById(R.id.tvCounter);
+ counter -= 1;
+ tvCounter.setText(String.valueOf(counter));
+ }
+ });
+ Button tileActivity = (Button) findViewById(R.id.buttonTileActivity);
+ tileActivity.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent ta = new Intent(getBaseContext(), TileActivity.class);
+ startActivity(ta);
+ }
+ });
}
+
}
diff --git a/src/main/java/nyc/c4q/SubFunClass.java b/src/main/java/nyc/c4q/SubFunClass.java
index ef94dce..3ab57c8 100644
--- a/src/main/java/nyc/c4q/SubFunClass.java
+++ b/src/main/java/nyc/c4q/SubFunClass.java
@@ -3,7 +3,18 @@
/**
* Created by amyquispe on 5/19/15.
*/
-public class SubFunClass {
+public class SubFunClass extends SuperFunClass implements AwesomeInterface{
public SubFunClass(){
+
+ }
+
+ @Override
+ public int getData() {
+ return 0;
+ }
+
+ @Override
+ public void setData(int someData) {
+
}
}
diff --git a/src/main/res/layout/activity_initial.xml b/src/main/res/layout/activity_initial.xml
index 49e22b0..7a32869 100644
--- a/src/main/res/layout/activity_initial.xml
+++ b/src/main/res/layout/activity_initial.xml
@@ -3,16 +3,62 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:text="Empty"/>
\ No newline at end of file
diff --git a/src/main/res/layout/activity_tile.xml b/src/main/res/layout/activity_tile.xml
index 4e36a11..5ac1d80 100644
--- a/src/main/res/layout/activity_tile.xml
+++ b/src/main/res/layout/activity_tile.xml
@@ -5,11 +5,57 @@
android:layout_height="match_parent"
tools:context="nyc.c4q.TileActivity"
android:id="@+id/activity_tile"
- >
-
-
+
+
+
+
+
+
+
+
+ android:layout_height="match_parent"
+ android:layout_weight="1">
+
+
+
+
+
+
+
+
diff --git a/src/test/java/nyc/c4q/Unit1AssessmentTestsAndroid.java b/src/test/java/nyc/c4q/Unit1AssessmentTestsAndroid.java
index bae0f78..8d78d66 100644
--- a/src/test/java/nyc/c4q/Unit1AssessmentTestsAndroid.java
+++ b/src/test/java/nyc/c4q/Unit1AssessmentTestsAndroid.java
@@ -4,6 +4,7 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;
+import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -36,6 +37,7 @@ public void test01FixInitialActivityLayout() throws Exception {
InitialActivity activity = Robolectric.buildActivity(InitialActivity.class).setup().get();
LinearLayout layout = (LinearLayout) activity.findViewById(R.id.activity_initial);
+ assertTrue("LinearLayout(@+id/activity_initial) should have a vertical orientation", layout.getOrientation() == LinearLayout.VERTICAL);
assertTrue("LinearLayout(@+id/activity_initial)[0] should be a LinearLayout", layout.getChildAt(0) instanceof LinearLayout);
LinearLayout counterLayout = (LinearLayout) layout.getChildAt(0);
assertTrue("LinearLayout(@+id/activity_initial)[0] should have R.id.counterLayout", Helpers.getResourceId(counterLayout).equals("counterLayout"));
@@ -61,7 +63,7 @@ public void test01FixInitialActivityLayout() throws Exception {
assertEquals("-", buttonMinus.getText());
View tvCounter = counterLayout.getChildAt(1);
- assertTrue("LinearLayout(@+id/activity_initial)[0][1] should be equal to TextView(@+id/tvCounter)",
+ assertTrue("LinearLayout(@+id/counterLayout)[1] should be equal to TextView(@+id/tvCounter)",
tvCounter instanceof TextView && Helpers.getResourceId(tvCounter).equals("tvCounter"));
assertEquals("0", ((TextView) tvCounter).getText());
@@ -75,23 +77,28 @@ public void test01FixInitialActivityLayout() throws Exception {
buttonEmpty instanceof Button && Helpers.getResourceId(buttonEmpty).equals("buttonEmpty"));
assertEquals("Empty", ((Button) buttonEmpty).getText());
+ assertEquals("LinearLayout(@+id/counterLayout) should have layout_height='0dp'", 0, counterLayout.getLayoutParams().height);
+ assertEquals("LinearLayout(@+id/counterLayout) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, counterLayout.getLayoutParams().width);
assertEquals("LinearLayout(@+id/counterLayout) should have layout_weight='2'", 2, ((LinearLayout.LayoutParams) counterLayout.getLayoutParams()).weight, 0.01);
+ assertEquals("Button (@+id/buttonTileActivity) should have layout_height='0dp'", 0, buttonTileActivity.getLayoutParams().height);
+ assertEquals("Button (@+id/buttonTileActivity) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, buttonTileActivity.getLayoutParams().width);
assertEquals("Button (@+id/buttonTileActivity) should have layout_weight='1'", 1, ((LinearLayout.LayoutParams) buttonTileActivity.getLayoutParams()).weight, 0.01);
+ assertEquals("Button (@+id/buttonEmpty) should have layout_height='0dp'", 0, buttonEmpty.getLayoutParams().height);
+ assertEquals("Button (@+id/buttonEmpty) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, buttonEmpty.getLayoutParams().width);
assertEquals("Button (@+id/buttonEmpty) should have layout_weight='1'", 1, ((LinearLayout.LayoutParams) buttonEmpty.getLayoutParams()).weight, 0.01);
+ assertEquals("LinearLayout(@+id/counterButtonsLayout) should have layout_height='match_parent'", LayoutParams.MATCH_PARENT, counterButtonsLayout.getLayoutParams().height);
+ assertEquals("LinearLayout(@+id/counterButtonsLayout) should have layout_width='0dp'", 0, counterButtonsLayout.getLayoutParams().width);
assertEquals("LinearLayout(@+id/counterButtonsLayout) should have layout_weight='1'", 1, ((LinearLayout.LayoutParams) counterButtonsLayout.getLayoutParams()).weight, 0.01);
+ assertEquals("TextView (@+id/tvCounter) should have layout_height='match_parent'", LayoutParams.MATCH_PARENT, tvCounter.getLayoutParams().height);
+ assertEquals("TextView (@+id/tvCounter) should have layout_width='0dp'", 0, tvCounter.getLayoutParams().width);
assertEquals("TextView (@+id/tvCounter) should have layout_weight='1'", 1, ((LinearLayout.LayoutParams) tvCounter.getLayoutParams()).weight, 0.01);
+ assertEquals("Button (@+id/buttonPlus) should have layout_height='0dp'", 0, buttonPlus.getLayoutParams().height);
+ assertEquals("Button (@+id/buttonPlus) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, buttonPlus.getLayoutParams().width);
assertEquals("Button (@+id/buttonPlus) should have layout_weight='1'", 1, ((LinearLayout.LayoutParams) buttonPlus.getLayoutParams()).weight, 0.01);
+ assertEquals("Button (@+id/buttonMinus) should have layout_height='0dp'", 0, buttonMinus.getLayoutParams().height);
+ assertEquals("Button (@+id/buttonMinus) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, buttonMinus.getLayoutParams().width);
assertEquals("Button (@+id/buttonMinus) should have layout_weight='1'", 1, ((LinearLayout.LayoutParams) buttonMinus.getLayoutParams()).weight, 0.01);
-
- assertEquals("LinearLayout(@+id/counterLayout) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) counterLayout.getLayoutParams()).height);
- assertEquals("Button (@+id/buttonTileActivity) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) buttonTileActivity.getLayoutParams()).height);
- assertEquals("Button (@+i/buttonEmpty) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) buttonEmpty.getLayoutParams()).height);
- assertEquals("LinearLayout(@+id/counterButtonsLayout) should have layout_width='0dp'", 0, ((LinearLayout.LayoutParams) counterButtonsLayout.getLayoutParams()).width);
- assertEquals("TextView (@+id/tvCounter) should have layout_width='0dp'", 0, ((LinearLayout.LayoutParams) tvCounter.getLayoutParams()).width);
- assertEquals("Button (@+id/buttonPlus) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) buttonPlus.getLayoutParams()).height);
- assertEquals("Button (@+id/buttonMinus) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) buttonMinus.getLayoutParams()).height);
-
}
@Test
@@ -100,11 +107,11 @@ public void test02ButtonPlusShouldIncreaseTvCounter() throws Exception {
Button buttonPlus = (Button) Helpers.findViewByIdString(activity, "buttonPlus");
TextView tvCounter = (TextView) Helpers.findViewByIdString(activity, "tvCounter");
- assertNotNull("TextView(@+id/buttonPlus) should not be null", buttonPlus);
+ assertNotNull("Button(@+id/buttonPlus) should not be null", buttonPlus);
assertNotNull("TextView(@+id/tvCounter) should not be null", tvCounter);
assertEquals(0, Integer.parseInt((String) tvCounter.getText()));
- for (int i=1; i<10; i++){
+ for (int i = 1; i < 10; i++) {
buttonPlus.callOnClick();
assertEquals(i, Integer.parseInt((String) tvCounter.getText()));
}
@@ -116,11 +123,11 @@ public void test03ButtonMinusShouldDecreaseTvCounter() throws Exception {
Button buttonMinus = (Button) Helpers.findViewByIdString(activity, "buttonMinus");
TextView tvCounter = (TextView) Helpers.findViewByIdString(activity, "tvCounter");
- assertNotNull("TextView(@+id/buttonMinus) should not be null", buttonMinus);
+ assertNotNull("Button(@+id/buttonMinus) should not be null", buttonMinus);
assertNotNull("TextView(@+id/tvCounter) should not be null", tvCounter);
assertEquals(0, Integer.parseInt((String) tvCounter.getText()));
- for (int i=-1; i>-10; i--){
+ for (int i = -1; i > -10; i--) {
buttonMinus.callOnClick();
assertEquals(i, Integer.parseInt((String) tvCounter.getText()));
}
@@ -133,20 +140,19 @@ public void test04ButtonPlusAndButtonMinusShouldWork() throws Exception {
Button buttonMinus = (Button) Helpers.findViewByIdString(activity, "buttonMinus");
TextView tvCounter = (TextView) Helpers.findViewByIdString(activity, "tvCounter");
- assertNotNull("TextView(@+id/buttonPlus) should not be null", buttonPlus);
- assertNotNull("TextView(@+id/buttonMinus) should not be null", buttonMinus);
+ assertNotNull("Button(@+id/buttonPlus) should not be null", buttonPlus);
+ assertNotNull("Button(@+id/buttonMinus) should not be null", buttonMinus);
assertNotNull("TextView(@+id/tvCounter) should not be null", tvCounter);
Random r = new Random(3680);
assertEquals(0, Integer.parseInt((String) tvCounter.getText()));
int internalCount = 0;
- for (int i=0; i<10000; i++){
- if (r.nextBoolean()){
+ for (int i = 0; i < 10000; i++) {
+ if (r.nextBoolean()) {
internalCount++;
buttonPlus.callOnClick();
- }
- else {
+ } else {
internalCount--;
buttonMinus.callOnClick();
}
@@ -155,7 +161,7 @@ public void test04ButtonPlusAndButtonMinusShouldWork() throws Exception {
}
@Test
- public void test05TvCounterStateShouldBeSavedThroughActivityLifeCycle(){
+ public void test05TvCounterStateShouldBeSavedThroughActivityLifeCycle() {
// use InitialActivity.saveState() and InitialActivity.loadState() methods
ActivityController controller = Robolectric.buildActivity(InitialActivity.class).setup();
InitialActivity activity = controller.get();
@@ -163,8 +169,8 @@ public void test05TvCounterStateShouldBeSavedThroughActivityLifeCycle(){
Button buttonMinus = (Button) Helpers.findViewByIdString(activity, "buttonMinus");
TextView tvCounter = (TextView) Helpers.findViewByIdString(activity, "tvCounter");
- assertNotNull("TextView(@+id/buttonPlus) should not be null", buttonPlus);
- assertNotNull("TextView(@+id/buttonMinus) should not be null", buttonMinus);
+ assertNotNull("Button(@+id/buttonPlus) should not be null", buttonPlus);
+ assertNotNull("Button(@+id/buttonMinus) should not be null", buttonMinus);
assertNotNull("TextView(@+id/tvCounter) should not be null", tvCounter);
assertEquals(0, Integer.parseInt((String) tvCounter.getText()));
@@ -203,72 +209,73 @@ public void test07FixTileActivityLayout() throws Exception {
TileActivity ta = Robolectric.buildActivity(TileActivity.class).setup().get();
LinearLayout taLayout = (LinearLayout) ta.findViewById(R.id.activity_tile);
- assertTrue("LinearLayout(@+id/activity_tile) should have a horizontal orientation",
- taLayout.getOrientation() == LinearLayout.HORIZONTAL);
+ assertTrue("LinearLayout(@+id/activity_tile) should have a horizontal orientation", taLayout.getOrientation() == LinearLayout.HORIZONTAL);
assertTrue("LinearLayout(@+id/activity_tile)[0] should be a LinearLayout", taLayout.getChildAt(0) instanceof LinearLayout);
LinearLayout leftSide = (LinearLayout) taLayout.getChildAt(0);
assertTrue("LinearLayout(@+id/activity_tile)[0] should have R.id.leftSide", Helpers.getResourceId(leftSide).equals("leftSide"));
assertTrue("LinearLayout(@+id/activity_tile)[0] should be equal to LinearLayout(@+id/leftSide)", leftSide == Helpers.findViewByIdString(ta, "leftSide"));
- assertTrue("LinearLayout(@+id/activity_tile)[0] should have a vertical orientation",
- leftSide.getOrientation() == LinearLayout.VERTICAL);
+ assertTrue("LinearLayout(@+id/activity_tile)[0] should have a vertical orientation", leftSide.getOrientation() == LinearLayout.VERTICAL);
assertEquals("View(@+id/leftSide) should have layout_weight='1'", 1, ((LinearLayout.LayoutParams) leftSide.getLayoutParams()).weight, 0.01);
assertTrue("LinearLayout(@+id/activity_tile)[1] should be a LinearLayout", taLayout.getChildAt(1) instanceof LinearLayout);
LinearLayout rightSide = (LinearLayout) taLayout.getChildAt(1);
assertTrue("LinearLayout(@+id/activity_tile)[1] should have R.id.rightSide", Helpers.getResourceId(rightSide).equals("rightSide"));
assertTrue("LinearLayout(@+id/activity_tile)[1] should be equal to LinearLayout(@+id/rightSide)", rightSide == Helpers.findViewByIdString(ta, "rightSide"));
- assertTrue("LinearLayout(@+id/activity_tile)[1] should have a vertical orientation",
- rightSide.getOrientation() == LinearLayout.VERTICAL);
+ assertTrue("LinearLayout(@+id/activity_tile)[1] should have a vertical orientation", rightSide.getOrientation() == LinearLayout.VERTICAL);
assertEquals("View(@+id/rightSide) should have layout_weight='1'", 1, ((LinearLayout.LayoutParams) rightSide.getLayoutParams()).weight, 0.01);
- View redView = leftSide.getChildAt(0);
+ View redView = leftSide.getChildAt(0);
assertTrue("LinearLayout(@+id/leftSide)[0] should have R.id.redView", Helpers.getResourceId(redView).equals("redView"));
assertTrue("LinearLayout(@+id/leftSide)[0] should be equal to View(@+id/redView)", redView == Helpers.findViewByIdString(ta, "redView"));
Drawable redViewBackground = redView.getBackground();
assertThat(redViewBackground, instanceOf(ColorDrawable.class));
assertEquals(0xffff0000, ((ColorDrawable) redViewBackground).getColor());
- View greenView = leftSide.getChildAt(1);
+ View greenView = leftSide.getChildAt(1);
assertTrue("LinearLayout(@+id/leftSide)[1] should have R.id.greenView", Helpers.getResourceId(greenView).equals("greenView"));
assertTrue("LinearLayout(@+id/leftSide)[1] should be equal to View(@+id/greenView)", greenView == Helpers.findViewByIdString(ta, "greenView"));
Drawable greenViewBackground = greenView.getBackground();
assertThat(greenViewBackground, instanceOf(ColorDrawable.class));
assertEquals(0xff00ff00, ((ColorDrawable) greenViewBackground).getColor());
- View yellowView = rightSide.getChildAt(0);
+ View yellowView = rightSide.getChildAt(0);
assertTrue("LinearLayout(@+id/rightSide)[0] should have R.id.yellowView", Helpers.getResourceId(yellowView).equals("yellowView"));
assertTrue("LinearLayout(@+id/rightSide)[0] should be equal to View(@+id/yellowView)", yellowView == Helpers.findViewByIdString(ta, "yellowView"));
Drawable yellowViewBackground = yellowView.getBackground();
assertThat(yellowViewBackground, instanceOf(ColorDrawable.class));
assertEquals(0xffffff00, ((ColorDrawable) yellowViewBackground).getColor());
- View whiteView = rightSide.getChildAt(1);
+ View whiteView = rightSide.getChildAt(1);
assertTrue("LinearLayout(@+id/rightSide)[1] should have R.id.whiteView", Helpers.getResourceId(whiteView).equals("whiteView"));
assertTrue("LinearLayout(@+id/rightSide)[1] should be equal to View(@+id/whiteView)", whiteView == Helpers.findViewByIdString(ta, "whiteView"));
Drawable whiteViewBackground = whiteView.getBackground();
assertThat(whiteViewBackground, instanceOf(ColorDrawable.class));
assertEquals(0xffffffff, ((ColorDrawable) whiteViewBackground).getColor());
- View blueView = rightSide.getChildAt(2);
+ View blueView = rightSide.getChildAt(2);
assertTrue("LinearLayout(@+id/rightSide)[2] should have R.id.blueView", Helpers.getResourceId(blueView).equals("blueView"));
assertTrue("LinearLayout(@+id/rightSide)[2] should be equal to View(@+id/blueView)", blueView == Helpers.findViewByIdString(ta, "blueView"));
Drawable blueViewBackground = blueView.getBackground();
assertThat(blueViewBackground, instanceOf(ColorDrawable.class));
assertEquals(0xff0000ff, ((ColorDrawable) blueViewBackground).getColor());
+ assertEquals("View(@+id/redView) should have layout_height='0dp'", 0, redView.getLayoutParams().height);
+ assertEquals("View(@+id/redView) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, redView.getLayoutParams().width);
assertEquals("View(@+id/redView) should have layout_weight='40'", 40, ((LinearLayout.LayoutParams) redView.getLayoutParams()).weight, 0.01);
+ assertEquals("View(@+id/greenView) should have layout_height='0dp'", 0, greenView.getLayoutParams().height);
+ assertEquals("View(@+id/greenView) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, greenView.getLayoutParams().width);
assertEquals("View(@+id/greenView) should have layout_weight='60'", 60, ((LinearLayout.LayoutParams) greenView.getLayoutParams()).weight, 0.01);
+ assertEquals("View(@+id/yellowView) should have layout_height='0dp'", 0, yellowView.getLayoutParams().height);
+ assertEquals("View(@+id/yellowView) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, yellowView.getLayoutParams().width);
assertEquals("View(@+id/yellowView) should have layout_weight='33'", 33, ((LinearLayout.LayoutParams) yellowView.getLayoutParams()).weight, 0.01);
+ assertEquals("View(@+id/whiteView) should have layout_height='0dp'", 0, whiteView.getLayoutParams().height);
+ assertEquals("View(@+id/whiteView) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, whiteView.getLayoutParams().width);
assertEquals("View(@+id/whiteView) should have layout_weight='44'", 44, ((LinearLayout.LayoutParams) whiteView.getLayoutParams()).weight, 0.01);
+ assertEquals("View(@+id/blueView) should have layout_height='0dp'", 0, blueView.getLayoutParams().height);
+ assertEquals("View(@+id/blueView) should have layout_width='match_parent'", LayoutParams.MATCH_PARENT, blueView.getLayoutParams().width);
assertEquals("View(@+id/blueView) should have layout_weight='22'", 22, ((LinearLayout.LayoutParams) blueView.getLayoutParams()).weight, 0.01);
- assertEquals("View(@+id/redView) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) redView.getLayoutParams()).height);
- assertEquals("View(@+id/greenView) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) greenView.getLayoutParams()).height);
- assertEquals("View(@+id/yellowView) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) yellowView.getLayoutParams()).height);
- assertEquals("View(@+id/whiteView) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) whiteView.getLayoutParams()).height);
- assertEquals("View(@+id/blueView) should have layout_height='0dp'", 0, ((LinearLayout.LayoutParams) blueView.getLayoutParams()).height);
-
}
}
diff --git a/src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java b/src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java
index de10077..d45c221 100644
--- a/src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java
+++ b/src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java
@@ -7,10 +7,10 @@
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.List;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;