Skip to content

Commit

Permalink
Moved assertions from ListViewAssert to AbstractListViewAssert.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fr Jeremy Krieg committed Mar 6, 2015
1 parent f04d8bb commit 7c4d76b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.widget.ListView;

import static android.os.Build.VERSION_CODES.GINGERBREAD;
import static android.os.Build.VERSION_CODES.KITKAT;
import static org.assertj.core.api.Assertions.assertThat;

public abstract class AbstractListViewAssert<S extends AbstractListViewAssert<S, A>, A extends ListView>
Expand Down Expand Up @@ -70,4 +71,40 @@ public S hasOverscrollHeader(Drawable header) {
.isSameAs(header);
return myself;
}

@TargetApi(KITKAT)
public S hasFooterDividersEnabled() {
isNotNull();
assertThat(actual.areFooterDividersEnabled()) //
.overridingErrorMessage("Expected to have footer dividers enabled but were not.") //
.isTrue();
return myself;
}

@TargetApi(KITKAT)
public S hasFooterDividersDisabled() {
isNotNull();
assertThat(actual.areFooterDividersEnabled()) //
.overridingErrorMessage("Expected to have footer dividers disabled but were not.") //
.isFalse();
return myself;
}

@TargetApi(KITKAT)
public S hasHeaderDividersEnabled() {
isNotNull();
assertThat(actual.areHeaderDividersEnabled()) //
.overridingErrorMessage("Expected to have header dividers enabled but were not.") //
.isTrue();
return myself;
}

@TargetApi(KITKAT)
public S hasHeaderDividersDisabled() {
isNotNull();
assertThat(actual.areHeaderDividersEnabled()) //
.overridingErrorMessage("Expected to have header dividers disabled but were not.") //
.isFalse();
return myself;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
// Copyright 2013 Square, Inc.
package org.assertj.android.api.widget;

import android.annotation.TargetApi;
import android.widget.ListView;

import static android.os.Build.VERSION_CODES.KITKAT;
import static org.assertj.core.api.Assertions.assertThat;

/**
* Assertions for {@link ListView} instances.
* <p>
Expand All @@ -16,40 +12,4 @@ public final class ListViewAssert extends AbstractListViewAssert<ListViewAssert,
public ListViewAssert(ListView actual) {
super(actual, ListViewAssert.class);
}

@TargetApi(KITKAT)
public ListViewAssert hasFooterDividersEnabled() {
isNotNull();
assertThat(actual.areFooterDividersEnabled()) //
.overridingErrorMessage("Expected to have footer dividers enabled but were not.") //
.isTrue();
return this;
}

@TargetApi(KITKAT)
public ListViewAssert hasFooterDividersDisabled() {
isNotNull();
assertThat(actual.areFooterDividersEnabled()) //
.overridingErrorMessage("Expected to have footer dividers disabled but were not.") //
.isFalse();
return this;
}

@TargetApi(KITKAT)
public ListViewAssert hasHeaderDividersEnabled() {
isNotNull();
assertThat(actual.areHeaderDividersEnabled()) //
.overridingErrorMessage("Expected to have header dividers enabled but were not.") //
.isTrue();
return this;
}

@TargetApi(KITKAT)
public ListViewAssert hasHeaderDividersDisabled() {
isNotNull();
assertThat(actual.areHeaderDividersEnabled()) //
.overridingErrorMessage("Expected to have header dividers disabled but were not.") //
.isFalse();
return this;
}
}

0 comments on commit 7c4d76b

Please sign in to comment.