Package com.mysticcoders.integrations

Source Code of com.mysticcoders.integrations.PasteServiceIntegrationTest

package com.mysticcoders.integrations;

import com.mysticcoders.mysticpaste.model.PasteItem;
import com.mysticcoders.mysticpaste.persistence.PasteItemDao;
import com.mysticcoders.mysticpaste.services.PasteService;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.unitils.hibernate.HibernateUnitils;
import org.unitils.spring.annotation.SpringBeanByType;

/**
* Copyright 2009 Mystic Coders, LLC
*
* @author: joed
* Date  : Mar 7, 2009
*/
public class PasteServiceIntegrationTest extends AbstractIntegrationTest {

    @SpringBeanByType
    private PasteService svc;

    @SpringBeanByType
    private PasteItemDao dao;

    // We start with verifying that the DB is correctly setup.
    @Test
    public void testMapping() {
        HibernateUnitils.assertMappingWithDatabaseConsistent();
    }

    @Test
    public void testCreateAndRetrieve() {
        PasteItem paste = new PasteItem();
        paste.setContent("TEST-DATA");
        paste.setType("text");

        String id = svc.createItem(paste);
        System.out.println(id);
        PasteItem item2 = svc.getItem(id);

        assertEquals(item2.getContent(), paste.getContent());
//        assertEquals(item2.getClientToken(), paste.getClientToken());

    }

/*
    @Test
    public void testCreatePrivateItem() {
        PasteItem paste = new PasteItem();
        paste.setContent("TEST-DATA");
        paste.setType("text");
        paste.setPrivate(true);

        String id = svc.createItem("CLIENT", paste);
        System.out.println(id);
        PasteItem item2 = svc.getItem("CLIENT", id);

        assertNotNull(item2.getPrivateToken());
        assertEquals(10, item2.getPrivateToken().length());
        System.out.println(item2.getPrivateToken());
    }
*/


TOP

Related Classes of com.mysticcoders.integrations.PasteServiceIntegrationTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.