Example #1
0
 @Test
 public void should_get_widgets() {
   final Views views = new Views(VIEWS);
   List<ViewProxy<Widget>> widgets = views.getWidgets(null, null, null, null);
   assertThat(widgets.size()).isEqualTo(1);
   assertThat(widgets.get(0).getTarget().getClass()).isEqualTo(FakeWidget.class);
 }
Example #2
0
 @Test
 public void getWidgets() {
   final Views views = new Views(VIEWS);
   List<ViewProxy<Widget>> widgets = views.getWidgets(null, null, null);
   assertThat(widgets.size(), is(1));
   assertThat(widgets.get(0).getTarget(), is(FakeWidget.class));
 }
Example #3
0
 @Test
 public void should_prefix_title_by_number_to_display_first() {
   final Views views =
       new Views(
           new View[] {
             new FakeWidget("other", "Other"),
             new FakeWidget("1id", "1widget"),
             new FakeWidget("2id", "2widget")
           });
   List<ViewProxy<Widget>> widgets = views.getWidgets(null, null, null, null);
   assertThat(widgets.size()).isEqualTo(3);
   assertThat(widgets.get(0).getId()).isEqualTo("1id");
   assertThat(widgets.get(1).getId()).isEqualTo("2id");
   assertThat(widgets.get(2).getId()).isEqualTo("other");
 }
Example #4
0
 @Test
 public void should_sort_views_by_title() {
   final Views views =
       new Views(
           new View[] {
             new FakeWidget("ccc", "ccc"),
             new FakeWidget("aaa", "aaa"),
             new FakeWidget("bbb", "bbb")
           });
   List<ViewProxy<Widget>> widgets = views.getWidgets(null, null, null, null);
   assertThat(widgets.size()).isEqualTo(3);
   assertThat(widgets.get(0).getId()).isEqualTo("aaa");
   assertThat(widgets.get(1).getId()).isEqualTo("bbb");
   assertThat(widgets.get(2).getId()).isEqualTo("ccc");
 }
Example #5
0
 @Test
 public void prefixTitleByNumberToDisplayFirst() {
   final Views views =
       new Views(
           new View[] {
             new FakeWidget("other", "Other"),
             new FakeWidget("1id", "1widget"),
             new FakeWidget("2id", "2widget")
           });
   List<ViewProxy<Widget>> widgets = views.getWidgets(null, null, null);
   assertThat(widgets.size(), is(3));
   assertThat(widgets.get(0).getId(), is("1id"));
   assertThat(widgets.get(1).getId(), is("2id"));
   assertThat(widgets.get(2).getId(), is("other"));
 }
Example #6
0
 @Test
 public void sortViewsByTitle() {
   final Views views =
       new Views(
           new View[] {
             new FakeWidget("ccc", "ccc"),
             new FakeWidget("aaa", "aaa"),
             new FakeWidget("bbb", "bbb")
           });
   List<ViewProxy<Widget>> widgets = views.getWidgets(null, null, null);
   assertThat(widgets.size(), is(3));
   assertThat(widgets.get(0).getId(), is("aaa"));
   assertThat(widgets.get(1).getId(), is("bbb"));
   assertThat(widgets.get(2).getId(), is("ccc"));
 }