/*
* Copyright 2008 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 java.util.Arrays;
import java.util.List;
import com.semagia.atomico.MediaType;
import com.semagia.atomico.server.dm.ISnapshotInfo;
/**
*
*
* @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
*/
public class TestSnapshotInfo extends AbstractDataModelTestCase {
private static final String _ID = "id";
private static final String _TITLE = "title";
private static final long _UPDATED = now();
private static final MediaType _MEDIA_TYPE = MediaType.valueOf("application/x-tm+xtm");
private static final String _SNAPSHOT_ID = "snapId";
private static void _testDefaultProperties(ISnapshotInfo info) {
assertEquals(_ID, info.getId());
assertEquals(_TITLE, info.getTitle());
assertEquals(_UPDATED, info.getUpdated());
assertEquals(_SNAPSHOT_ID, info.getSnapshotId());
}
public void testProperties() {
ISnapshotInfo info = new SnapshotInfo(_ID, _TITLE, _UPDATED, _MEDIA_TYPE, _SNAPSHOT_ID);
_testDefaultProperties(info);
assertEquals(1, info.getMediaTypes().size());
assertEquals(_MEDIA_TYPE, info.getMediaTypes().iterator().next());
}
public void testProperties2() {
final List<MediaType> mediaTypes = Arrays.asList(_MEDIA_TYPE, MediaType.valueOf("application/x-tm+snello"));
ISnapshotInfo info = new SnapshotInfo(_ID, _TITLE, _UPDATED, mediaTypes, _SNAPSHOT_ID);
_testDefaultProperties(info);
assertEquals(2, info.getMediaTypes().size());
assertEquals(mediaTypes, info.getMediaTypes());
}
}