Example usage for junit.framework Assert assertEquals

List of usage examples for junit.framework Assert assertEquals

Introduction

In this page you can find the example usage for junit.framework Assert assertEquals.

Prototype

static public void assertEquals(String message, int expected, int actual) 

Source Link

Document

Asserts that two ints are equal.

Usage

From source file:com.tino23.cput.TestOcpVio.java

@Test
public void testRectArea() {
    shapeArea = (GetShapeArea) ctx.getBean("shape");
    double area = shapeArea.area("Rectangle");
    Assert.assertEquals(area, 150, 5);
}

From source file:edu.northwestern.bioinformatics.studycalendar.dao.LegacyUserProvisioningRecordDaoTest.java

public void testUsersWithSiteRolesSelected() throws Exception {
    List<LegacyUserProvisioningRecord> actual = dao.getAll();

    LegacyUserProvisioningRecord first = actual.get(0);
    Assert.assertEquals("Wrong name", "Al", first.getUserName());
    Assert.assertEquals("Wrong Role", "STUDY_ADMIN", first.getRole());
    assertTrue("Site should be blank", isBlank(first.getSiteName()));
    assertTrue("Study should be blank", isBlank(first.getStudyName()));

    LegacyUserProvisioningRecord second = actual.get(1);
    Assert.assertEquals("Wrong name", "Al", second.getUserName());
    Assert.assertEquals("Wrong role", "SUBJECT_COORDINATOR", second.getRole());
    Assert.assertEquals("Wrong site", "Alpha Centauri", second.getSiteName());
    Assert.assertEquals("Wrong study", "Artichoke Study", second.getStudyName());

    LegacyUserProvisioningRecord third = actual.get(2);
    Assert.assertEquals("Wrong name", "Al", third.getUserName());
    Assert.assertEquals("Wrong role", "SUBJECT_COORDINATOR", third.getRole());
    Assert.assertEquals("Wrong site", "Alpha Centauri", third.getSiteName());
    Assert.assertEquals("Wrong study", "Cartwheel Study", third.getStudyName());

    LegacyUserProvisioningRecord fourth = actual.get(3);
    Assert.assertEquals("Wrong name", "Al", fourth.getUserName());
    Assert.assertEquals("Wrong role", "SUBJECT_COORDINATOR", fourth.getRole());
    Assert.assertEquals("Wrong site", "Canopus", fourth.getSiteName());
    assertTrue("Study should be blank", isBlank(fourth.getStudyName()));
}

From source file:com.gisgraphy.helper.StringHelperTest.java

@Test
public void testNormalize() {
    Assert.assertEquals("letter without accent should not be modified",
            " e e e e e je me souviens de ce zouave qui jouait du xylophone en buvant du whisky c est ok c est super",
            StringHelper.normalize(/*  w ww.  ja v  a2 s. co  m*/
                    "- \u00E8 \u00E9 \u00EA \u00EB JE ME SOUVIENS de ce zouave qui jouait du-xylophone en buvant.du whisky c'est ok c\"est super "));
}

From source file:net.sf.dynamicreports.test.jasper.AbstractJasperChartTest.java

protected void chartCountTest(String name, int expectedNumberOfCharts) {
    Assert.assertEquals("chart count " + name, expectedNumberOfCharts, findElement(name).size());
}

From source file:org.springmodules.cache.config.ConfigAssert.java

/**
 * Asserts that the given bean definition wraps a bean of the given class.
 * /*from   www  .j ava  2s.  c o  m*/
 * @param beanDefinition
 *          the given bean definition
 * @param expectedClass
 *          the expected class of the wrapped bean
 */
public static void assertBeanDefinitionWrapsClass(AbstractBeanDefinition beanDefinition, Class expectedClass) {
    Assert.assertEquals("<Bean definition class>", expectedClass, beanDefinition.getBeanClass());
}

From source file:pandora.redis.dao.RedisUserDaoTest.java

@Test
public void user() {
    try {//from w  w w.j  a  va 2 s.  c o m
        User user = new User();

        int id = 1000000001;
        String name = "name";

        user.setId(id);
        user.setName(name);

        /*
         * set
         */
        userDao.setUser(user);
        User user4redis = userDao.getUser(user);

        Assert.assertEquals("set id", user.getId(), user4redis.getId());
        Assert.assertEquals("set name", user.getName(), user4redis.getName());

        /*
         * chg
         */
        user.setName("name-chg");
        userDao.chgUser(user);

        user4redis = userDao.getUser(user);

        Assert.assertEquals("chg id", user.getId(), user4redis.getId());
        Assert.assertEquals("chg name", user.getName(), user4redis.getName());

        /*
         * del
         */
        userDao.delUser(user);
        user4redis = userDao.getUser(user);

        Assert.assertNull("del", user4redis);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.kenshoo.facts.FactsToJsonFileTest.java

@Test
public void writeFactsFile() throws Exception {
    HashMap<String, String> props = new HashMap<String, String>();
    props.put("Dog", "Labrador");
    props.put("Cat", "Lion");

    factsToJsonFile = prepareMock(props, null);

    String jsonFacts = FileUtils/* ww  w .  j  av  a2s .  c  o m*/
            .readFileToString(factsToJsonFile.toJsonFileFromMapFacts(props, FACTS_JSON_FILE_NAME));
    HashMap<String, String> factsFromFile = new Gson().fromJson(jsonFacts, HashMap.class);

    Assert.assertEquals("Number of facts got from file is wrong", factsFromFile.size(), 2);
    Assert.assertEquals("Fact is different", factsFromFile.get("Dog"), "Labrador");
    Assert.assertEquals("Fact is different", factsFromFile.get("Cat"), "Lion");
    verify(factsToJsonFile, times(1)).getExternalFactsFolder();
    verify(factsToJsonFile, times(1)).toJsonFileFromMapFacts(same(props), same(FACTS_JSON_FILE_NAME));
    verify(factsToJsonFile, times(1)).toJsonFileFromMapFacts(same(props), same(FACTS_JSON_FILE_NAME),
            isNull(Set.class));
}

From source file:com.tino23.cput.TestOcpVio.java

@Test
public void testCircArea() {
    shapeArea = (GetShapeArea) ctx.getBean("shape");
    double area = shapeArea.area("Circle");
    Assert.assertEquals(314, area, 5);
}

From source file:org.openxdata.server.service.impl.FormDefServiceTest.java

@Test
public void getForms_shouldReturnAllForms() throws Exception {

    List<FormDef> forms = studyManagerService.getForms();

    Assert.assertNotNull(forms);//w w  w .j  av a  2 s  .c  o m
    Assert.assertEquals("The number of forms is 5", 5, forms.size());
    Assert.assertNotNull(getForm("Sample Form", forms));
}

From source file:org.openxdata.server.service.impl.StudyManagerServiceTest.java

@Test
public void getStudies_shouldReturnAllStudies() throws Exception {
    List<StudyDef> studies = studyManagerService.getStudies();

    Assert.assertNotNull(studies);/* w  w w  . j av a2  s. c om*/
    Assert.assertEquals("There are 4 studies", 4, studies.size());
    Assert.assertNotNull(getStudy("Sample Study", studies));
}