Package com.dodo.blog.server.impl.it

Source Code of com.dodo.blog.server.impl.it.PlaygroundServiceTest

package com.dodo.blog.server.impl.it;

import com.dodo.blog.model.Playground;
import com.dodo.blog.request.BasicRequest;
import com.dodo.blog.server.PlaygroundService;
import com.google.guiceberry.junit4.GuiceBerryRule;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;

import javax.inject.Inject;
import java.util.List;

/**
* @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
*/
public class PlaygroundServiceTest
        extends ServicesEnvironment
{
    @Rule
    public final GuiceBerryRule guiceBerry = new GuiceBerryRule( ServicesEnvironment.class );

    @Inject
    private PlaygroundService playgroundService;

    @Test
    public void testSavePlayground()
    {
        Assert.assertNotNull( savePlayground().getId() );
    }

    @Test
    public void testDeletePlayground()
    {
        Playground playground = savePlayground();

        Long id = playground.getId();
        playgroundService.deletePlayground( id );
        Assert.assertNull( playgroundService.getPlaygroundById( id ) );
    }

    @Test
    public void testGetPlaygroundList()
    {
        savePlayground();

        List<Playground> playground = playgroundService.getPlaygroundList( new BasicRequest( 0, 20 ) );
        Assert.assertEquals( 1, playground.size() );
        Assert.assertEquals( "CSS 3 border radius test", playground.get( 0 ).getDescription() );
    }

    private Playground savePlayground()
    {
        Playground playground = new Playground();
        playground.setDescription( "CSS 3 border radius test" );
        playgroundService.savePlayground( playground );

        return playground;
    }
}
TOP

Related Classes of com.dodo.blog.server.impl.it.PlaygroundServiceTest

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.