package com.hida.service;

import com.hida.dao.PurlDao;
import com.hida.model.Purl;
import org.mockito.InjectMocks;
import static org.mockito.Matchers.any;
import org.mockito.Mock;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;

/**
 * This class tests the functionality of MinterServiceImpl using Mockito.
 *
 * @author lruffin
 */
public class ResolverServiceImplTest {

    @Mock
    private PurlDao Dao;

    @InjectMocks
    private ResolverServiceImpl Service;
    
    /**
     * Sets up Mockito
     *
     * @throws Exception
     */
    @BeforeClass
    public void setUpClass() throws Exception {
        MockitoAnnotations.initMocks(this);        
    }

    @Test
    public void testRetrieveURL() {
        Purl entity = new Purl();
        entity.setURL("");
        when(Dao.findByPurl(any(String.class))).thenReturn(entity);
        
        Service.retrieveURL("");
        
        verify(Dao, atLeastOnce()).findByPurl(any(String.class));
    }

    @Test
    public void editURL() {
        Assert.fail("unimplemented");
    }

    @Test
    public void deletePURL() {
        Assert.fail("unimplemented");
    }

    @Test
    public void retrieveModel() {
        Assert.fail("unimplemented");
    }

    @Test
    public void insertPURL() {
        Assert.fail("unimplemented");
    }

}

@@ -878,32 +878,119 @@
         %0A    %7D%0A%0A
+    /**%0A     * Tests to see if the URL of a given entity is properly retrieved%0A     */%0A
     @Test%0A    pu
@@ -1264,32 +1264,95 @@
 class));%0A    %7D%0A%0A
+    /**%0A     * Tests to see if an entity can be edited%0A     */%0A
     @Test%0A    pu
@@ -1361,17 +1361,21 @@
 ic void 
-e
+testE
 ditURL()
@@ -1372,24 +1372,32 @@
 tEditURL() %7B
+        
 %0A        Ass
@@ -1397,37 +1397,226 @@
     
-Assert.fail(%22unimplemented%22);
+Purl entity = new Purl();%0A        when(Dao.findByPurl(any(String.class))).thenReturn(entity);%0A        %0A        Service.editURL(%22%22, %22%22);%0A        verify(Dao, atLeastOnce()).findByPurl(any(String.class));%0A                
 %0A   
@@ -1645,17 +1645,21 @@
 ic void 
-d
+testD
 eletePUR
@@ -1735,17 +1735,21 @@
 ic void 
-r
+testR
 etrieveM
@@ -1828,17 +1828,21 @@
 ic void 
-i
+testI
 nsertPUR

Complete testEditURL