Пример #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);
 }
Пример #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));
 }
Пример #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");
 }
Пример #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");
 }
Пример #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"));
 }
Пример #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"));
 }