Package com.semagia.atomico.server.dm.impl

Source Code of com.semagia.atomico.server.dm.impl.TestAbstractEntity

/*
* Copyright 2008 - 2009 Lars Heuer (heuer[at]semagia.com). All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.semagia.atomico.server.dm.impl;

import com.semagia.atomico.dm.IEntity;
import com.semagia.atomico.server.dm.impl.AbstractEntity;

import junit.framework.TestCase;

/**
* Tests against the {@link AbstractEntity} class.
*
* @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
*/
public class TestAbstractEntity extends TestCase {

    private static final String _ID = "myId";
    private static final String _TITLE = "MyTitle";
    private static final long _UPDATED = System.currentTimeMillis();


    public void testValidEntity() {
        IEntity entity = new MyEntity(_ID, _TITLE, _UPDATED);
        assertEquals(_ID, entity.getId());
        assertEquals(_TITLE, entity.getTitle());
        assertEquals(_UPDATED, entity.getUpdated());
    }

    public void testInvalidId() {
        try {
            new MyEntity(null, _TITLE, _UPDATED);
            fail("Expected an IAE for id == null");
        }
        catch (IllegalArgumentException ex) {
            // noop.
        }
    }

    public void testInvalidTitle() {
        try {
            new MyEntity(_ID, null, _UPDATED);
            fail("Expected an IAE for title == null");
        }
        catch (IllegalArgumentException ex) {
            // noop.
        }
    }


    /**
     * Entity that does not add any functionality to the AbstractEntity class.
     */
    class MyEntity extends AbstractEntity {
        MyEntity(String id, String title, long updated) {
            super(id, title, updated);
        }
    }

}
TOP

Related Classes of com.semagia.atomico.server.dm.impl.TestAbstractEntity

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.