package de.ddb.pdc.web;


import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;

import de.ddb.pdc.metadata.DDBItem;
import de.ddb.pdc.metadata.MetaFetcher;

public class SearchControllerTest {

  @Test
  public void search() {
    MetaFetcher fetcher = Mockito.mock(MetaFetcher.class);
    DDBItem[] result = new DDBItem[0];
    Mockito.when(fetcher.searchForItems("foo", 0, 10, "relevance")).thenReturn(result);
    SearchController controller = new SearchController(fetcher);
    Assert.assertSame(result, controller.search("foo", 10, null));
  }
}

@@ -19,16 +19,55 @@
 .web;%0A%0A%0A
+import de.ddb.pdc.metadata.SearchItem;%0A
 import o
@@ -380,16 +380,71 @@
 tem%5B0%5D;%0A
+    SearchItem searchItem = new SearchItem(0, result);%0A
     Mock
@@ -514,22 +514,26 @@
 nReturn(
-result
+searchItem
 );%0A    S
@@ -614,22 +614,26 @@
 ertSame(
-result
+searchItem
 , contro

change search to SearchItem