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(int expected, int actual) 

Source Link

Document

Asserts that two ints are equal.

Usage

From source file:de.elomagic.vaadin.addon.speechrecognition.SpeechRecognitionEventDataTest.java

@Test
public void testDeserializeJSON1() throws Exception {
    // Prepare test
    Gson gson = getGson();//from   w  w  w.j a v  a  2  s  .  c  o m

    // Do test
    SpeechRecognitionEventData data = gson.fromJson(readJsonFile1(), SpeechRecognitionEventData.class);

    // Validate results
    Assert.assertEquals(1398436490336l, data.getTimeStamp().getTime());
    Assert.assertEquals("start", data.getType());
}

From source file:com.logsniffer.model.support.LineInputStreamTest.java

@Test
public void testDefaultNL() throws IOException {
    FileLog flog = new FileLog(writeString2Tmp("line1\nline2", "UTF-8"));
    DirectFileLogAccess logAccess = new DirectFileLogAccess(flog);
    LineInputStream log = new LineInputStream(logAccess, logAccess.getInputStream(null), "UTF-8");
    LogPointer start = log.getPointer();
    Assert.assertEquals("line1", log.readNextLine());
    Assert.assertEquals("line1\n".length(), logAccess.getDifference(start, log.getPointer()));
    Assert.assertEquals(false, log.getPointer().isEOF());
    Assert.assertEquals("line2", log.readNextLine());
    log.close();//from w ww  . ja  v a 2s  .c o  m

    log = new LineInputStream(logAccess,
            logAccess.getInputStream(logAccess.createRelative(null, "line1\n".length())), "UTF-8");
    Assert.assertEquals("line2", log.readNextLine());
    Assert.assertNull(log.readNextLine());
    Assert.assertEquals(true, log.getPointer().isEOF());
    log.close();
}

From source file:eagle.dataproc.util.TestConfigOptionParser.java

@Test
public void testValidCommandArguments() throws ParseException {
    String[] arguments = new String[] { "-D", "key1=value1", "-D", "key2=value2", "-D", "key3=value3=something",
            "-D", "key4=", "-D", "key5=\"--param having whitespace\"" };

    Map<String, String> config = new ConfigOptionParser().parseConfig(arguments);

    Assert.assertTrue(config.containsKey("key1"));
    Assert.assertTrue(config.containsKey("key2"));
    Assert.assertTrue(config.containsKey("key3"));
    Assert.assertTrue(config.containsKey("key4"));
    Assert.assertEquals("value1", config.get("key1"));
    Assert.assertEquals("value2", config.get("key2"));
    Assert.assertEquals("value3=something", config.get("key3"));
    Assert.assertEquals("", config.get("key4"));
    Assert.assertEquals("\"--param having whitespace", config.get("key5"));
}

From source file:org.apache.vysper.xmpp.extension.xep0124.inttests.MethodsNotAllowedIntegrationTest.java

@Test
public void doNotAllowDelete() throws Exception {
    HttpResponse response = httpclient.execute(new HttpDelete(getServerUrl()));

    Assert.assertEquals(405, response.getStatusLine().getStatusCode());
}

From source file:com.clover.sdk.v1.app.AppNotification.java

public AppNotification(Intent intent) {
    Assert.assertEquals(AppNotificationIntent.ACTION_APP_NOTIFICATION, intent.getAction());
    appEvent = intent.getStringExtra(AppNotificationIntent.EXTRA_APP_EVENT);
    payload = intent.getStringExtra(AppNotificationIntent.EXTRA_PAYLOAD);
}

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

@Test
public void saveRole_shouldSaveRole() throws Exception {
    Assert.assertEquals(2, roleService.getRoles().size());

    roleService.saveRole(new Role("Role Name"));

    Assert.assertEquals(3, roleService.getRoles().size());
}

From source file:com.google.api.ads.adwords.jaxws.extensions.report.model.definitions.ReportGeoDefinitionTest.java

@Override
protected void testFirstEntry(ReportGeo first) {
    Assert.assertEquals(6039084783L, first.getAdGroupId().longValue());
    Assert.assertEquals("General", first.getAdGroupName());
    Assert.assertEquals("enabled", first.getAdGroupStatus());
    Assert.assertEquals("Unspecified", first.getCityCriteriaId());
    Assert.assertEquals("United States", first.getCountryTerritory());
    Assert.assertEquals("true", first.getIsTargetable());
    Assert.assertEquals("", first.getMetroArea());
    Assert.assertEquals("United States", first.getMostSpecificLocation());
    Assert.assertEquals("Froody Rudy", first.getAccountDescriptiveName());
    Assert.assertEquals("2014-03-01", first.getMonth());
    Assert.assertEquals(BigDecimalUtil.parseFromNumberString("0.00"),
            BigDecimalUtil.parseFromNumberString(first.getCost()));
    Assert.assertEquals(0, first.getClicks().longValue());
    Assert.assertEquals(2, first.getImpressions().longValue());
    Assert.assertEquals("0.00", first.getCtr());
    Assert.assertEquals("0.00", first.getAvgCpm());
    Assert.assertEquals("0.00", first.getAvgCpc());
    Assert.assertEquals("1.00", first.getAvgPosition());
    Assert.assertEquals("0.00", first.getConversionRateManyPerClick());
    Assert.assertEquals("0.00", first.getConversionRate());
    Assert.assertEquals(6671111111L, first.getAccountId().longValue());
}

From source file:org.ocpsoft.rewrite.servlet.validate.BindingValidationTest.java

@Test
public void testConfigurationProviderForward() throws Exception {
    HttpAction<HttpGet> action = get("/v/valid");
    Assert.assertEquals(205, action.getResponse().getStatusLine().getStatusCode());
}

From source file:com.google.api.ads.adwords.awreporting.model.definitions.ReportPlacementDefinitionTest.java

@Override
protected void testFirstEntry(ReportPlacement first) {
    Assert.assertEquals(1154812872L, first.getAdGroupId().longValue());
    Assert.assertEquals("Digital-TV", first.getAdGroupName());
    Assert.assertEquals("enabled", first.getAdGroupStatus());
    Assert.assertEquals(42344742L, first.getCampaignId().longValue());
    Assert.assertEquals("[Generic] Private", first.getCampaignName());
    Assert.assertEquals("www.common.se", first.getDisplayName());
    Assert.assertEquals(" --", first.getCriterionId());
    Assert.assertEquals(0l, first.getMaxCpm().longValue());
    Assert.assertEquals("www.common.se", first.getPlacementUrl());
    Assert.assertEquals("2014-03-01", first.getMonth());
    Assert.assertEquals(1.61, first.getCost().doubleValue());
    Assert.assertEquals(1, first.getClicks().longValue());
    Assert.assertEquals(1, first.getImpressions().longValue());
    Assert.assertEquals("100.00", first.getCtr());
    Assert.assertEquals(1610.00, first.getAvgCpm().doubleValue());
    Assert.assertEquals(1.61, first.getAvgCpc().doubleValue());
    Assert.assertEquals("Computers", first.getDevice());
    Assert.assertEquals("Headline", first.getClickType());
    Assert.assertEquals("Search Network", first.getAdNetwork());
    Assert.assertEquals("Search partners", first.getAdNetworkPartners());
}