Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.java
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.java	(revision 4651)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.java	(revision 4652)
@@ -52,8 +52,13 @@
 
     public RecordPage(PageParameters params) {
-        super(new SolrDocumentModel(params.get("docId").toString()));
+        super(params);
+        
+        final SolrDocumentModel documentModel = new SolrDocumentModel(params.get("docId").toString());
+        setModel(documentModel);
+        
         final QueryFacetsSelection selection = selectionParametersConverter.fromParameters(params);
         this.contextModel = Model.of(selection);
-        addComponents(getModel());
+        
+        addComponents(documentModel);
     }
 
@@ -65,7 +70,4 @@
 
     private void addComponents(IModel<SolrDocument> documentModel) {
-        if (documentModel.getObject() == null) {
-            throw new RuntimeException("Document not found in model " + documentModel.toString());
-        }
         add(new SolrFieldLabel("name", documentModel, FacetConstants.FIELD_NAME, "Unnamed record"));
         add(createLandingPageLink("landingPageLink", documentModel));
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/wicket/pages/TestFacetedSearchPage.java
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/wicket/pages/TestFacetedSearchPage.java	(revision 4651)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/wicket/pages/TestFacetedSearchPage.java	(revision 4652)
@@ -20,7 +20,5 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -28,12 +26,9 @@
 
 /**
- * Abstract base class for tests that require dependency injection of (mock)
- * objects and services. Based on blog post by Petri Kainulainen found at
+ * Mock injection based on blog post by Petri Kainulainen found at
  * {@link http://www.petrikainulainen.net/programming/tips-and-tricks/mocking-spring-beans-with-apache-wicket-and-mockito/}
- *
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(loader = AnnotationConfigContextLoader.class)
-//@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) // gives us a fresh context for each test
 public class TestFacetedSearchPage {
 
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/wicket/pages/TestRecordPage.java
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/wicket/pages/TestRecordPage.java	(revision 4651)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/wicket/pages/TestRecordPage.java	(revision 4652)
@@ -6,12 +6,17 @@
 import eu.clarin.cmdi.vlo.config.VloConfigFactory;
 import eu.clarin.cmdi.vlo.config.VloSpringConfig;
-import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection;
+import eu.clarin.cmdi.vlo.service.SolrDocumentService;
 import org.apache.solr.common.SolrDocument;
-import org.apache.wicket.model.Model;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.util.tester.WicketTester;
+import org.jmock.Expectations;
+import static org.jmock.Expectations.returnValue;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JUnit4Mockery;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.test.annotation.DirtiesContext;
@@ -21,4 +26,8 @@
 import org.springframework.test.context.support.AnnotationConfigContextLoader;
 
+/**
+ * Mock injection based on blog post by Petri Kainulainen found at
+ * {@link http://www.petrikainulainen.net/programming/tips-and-tricks/mocking-spring-beans-with-apache-wicket-and-mockito/}
+ */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(loader = AnnotationConfigContextLoader.class)
@@ -28,4 +37,14 @@
     @Configuration
     static class ContextConfiguration extends VloSpringConfig {
+
+        @Bean
+        public Mockery mockery() {
+            return new JUnit4Mockery();
+        }
+
+        @Override
+        public SolrDocumentService documentService() {
+            return mockery().mock(SolrDocumentService.class);
+        }
 
         @Override
@@ -40,7 +59,11 @@
     @Autowired(required = true)
     private VloWicketApplication application;
+    @Autowired(required = true)
+    private Mockery mockery;
+    @Autowired(required = true)
+    private SolrDocumentService documentService;
 
-    private QueryFacetsSelection selection;
     private SolrDocument document;
+    private PageParameters params;
 
     @Before
@@ -48,10 +71,17 @@
         tester = new WicketTester(application);
         document = new SolrDocument();
-        selection = new QueryFacetsSelection();
+        params = new PageParameters();
+        params.set("docId", "docId");
     }
 
     @Test
     public void testRendersSuccessfully() {
-        tester.startPage(new RecordPage(new Model(document), new Model(selection)));
+        mockery.checking(new Expectations() {
+            {
+                oneOf(documentService).getDocument("docId");
+                will(returnValue(document));
+            }
+        });
+        tester.startPage(RecordPage.class, params);
         //assert rendered page class
         tester.assertRenderedPage(RecordPage.class);
@@ -60,5 +90,11 @@
     @Test
     public void testLandingPageLinkInvisible() {
-        tester.startPage(new RecordPage(new Model(document), new Model(selection)));
+        mockery.checking(new Expectations() {
+            {
+                oneOf(documentService).getDocument("docId");
+                will(returnValue(document));
+            }
+        });
+        tester.startPage(RecordPage.class, params);
         // no landing page for document, assert landing page link is invisible
         tester.assertInvisible("landingPageLink");
@@ -68,9 +104,16 @@
     public void testLandingPageLinkVisible() {
         document.addField(FacetConstants.FIELD_LANDINGPAGE, "http://www.landingpage.com");
-        tester.startPage(new RecordPage(new Model(document), new Model(selection)));
+
+        mockery.checking(new Expectations() {
+            {
+                oneOf(documentService).getDocument("docId");
+                will(returnValue(document));
+            }
+        });
+        tester.startPage(RecordPage.class, params);
         // document has a landing page, assert link is invisible
         tester.assertVisible("landingPageLink");
     }
-    
+
     //TODO: Add test for display of resources
 }
