Package uk.org.woodcraft.bookings.test

Source Code of uk.org.woodcraft.bookings.test.TestUtilsTest

package uk.org.woodcraft.bookings.test;

import static org.junit.Assert.fail;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

import uk.org.woodcraft.bookings.datamodel.Event;
import uk.org.woodcraft.bookings.datamodel.NamedEntity;
import uk.org.woodcraft.bookings.pricing.RegisteredPricingStrategy;

public class TestUtilsTest {

  @Test
  public void testAssertNames() {
   
    // Empty case
    TestUtils.assertNames(new ArrayList<NamedEntity>());
   
   
    List<NamedEntity> events = new ArrayList<NamedEntity>();
    events.add(new Event("test1", null, null, false, RegisteredPricingStrategy.COCAMP));
    events.add(new Event("test2", null, null, false, RegisteredPricingStrategy.COCAMP));
   
    TestUtils.assertNames(events, "test1", "test2");
   
    try
    {
      TestUtils.assertNames(events, "test1");
      fail("Should have assertion error");
    }
    catch(AssertionError failure)
    {}
   
    try
    {
      TestUtils.assertNames(events, "test1", "test3");
      fail("Should have assertion error");
    }
    catch(AssertionError failure)
    {}
   
    try
    {
      TestUtils.assertNames(events, "test1", "test2","test3");
      fail("Should have assertion error");
    }
    catch(AssertionError failure)
    {}
   
  }

}
TOP

Related Classes of uk.org.woodcraft.bookings.test.TestUtilsTest

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.