/*
* Copyright 2009 Peter Karich, peat_hal ‘at’ users ‘dot’ sourceforge ‘dot’ net.
*
* 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.
* under the License.
*/
package de.timefinder.data;
import de.timefinder.data.Feature;
import de.timefinder.data.Event;
import de.timefinder.data.TimeFinderTester;
import de.timefinder.data.Location;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Peter Karich, peat_hal ‘at’ users ‘dot’ sourceforge ‘dot’ net
*/
public class LocationTest extends TimeFinderTester {
private Location instance;
public LocationTest() {
}
@Before
@Override
public void setUp() {
super.setUp();
instance = new Location();
}
@Test
public void testSetRelationships() {
System.out.println("setRelationships");
Event ev = new Event();
ev.setLocation(instance, false);
assertEquals(instance, ev.getLocation());
assertFalse(instance.getEvents().contains(ev));
// do not remove location from event if location does not have this event
instance.removeEvent(ev, true);
assertEquals(instance, ev.getLocation());
}
@Test
public void testSetCapacity() {
System.out.println("setCapacity");
int capacity = 534;
instance.setCapacity(capacity);
assertEquals(instance.getCapacity(), capacity);
}
@Test
public void addFeature() {
Location room = newLocation("test");
Feature f = newFeature("feature");
room.addFeature(f);
assertEquals(f, room.getFeatures().iterator().next());
Feature feature = new Feature();
instance.addFeature(feature);
instance.addFeature(feature);
assertEquals(1, instance.getFeatures().size());
}
@Test
public void addEvent() {
Event ev = newEvent("test");
instance.addEvent(ev, true);
instance.addEvent(ev, true);
assertEquals(1, instance.getEvents().size());
}
}