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 testDeserializeJSON2() throws Exception {
    // Prepare test
    Gson gson = getGson();//  w w w  . ja  v a  2s .  c  o  m

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

    // Validate results
    Assert.assertEquals("result", data.getType());
    Assert.assertEquals(1, data.getResults().size());
    Assert.assertEquals(1, data.getResults().get(0).size());
    Assert.assertEquals("Heinz", data.getResults().get(0).get(0).getTranscript());
    Assert.assertEquals(0.009999999776482582, data.getResults().get(0).get(0).getConfidence());
    //Assert.assertEquals(1, data.getResults().size());
}

From source file:net.idea.opentox.cli.test.DatasetClientTest.java

@Override
public void testRead() throws Exception {
    DatasetClient<POLICY_RULE> otClient = getOTClient();
    List<Dataset> dataset = otClient
            .getJSON(new Identifier(String.format("%s%s/1/metadata", TEST_SERVER, Resources.dataset)));
    Assert.assertEquals(1, dataset.size());
}

From source file:cec.easyshop.facades.suggestion.DefaultSimpleSuggestionFacadeIntegrationTest.java

@Test
public void testReferencesForPurchasedInCategory() {
    final UserModel user = userService.getUserForUID("dejol");
    userService.setCurrentUser(user);/*from w w  w.ja v a  2  s . com*/
    List<ProductData> result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Collections.EMPTY_LIST, false, null);
    Assert.assertEquals(4, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras", Collections.EMPTY_LIST,
            false, NumberUtils.INTEGER_ONE);
    Assert.assertEquals(1, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.SIMILAR), false, null);
    Assert.assertEquals(1, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), false, null);
    Assert.assertEquals(2, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), true, null);
    Assert.assertEquals(1, result.size());
    final ProductData product = result.get(0);
    Assert.assertEquals("adapterDC", product.getCode());
    Assert.assertEquals("adapter", product.getName());
}

From source file:org.obiba.onyx.print.impl.DefaultPrintableReportsRegistryTest.java

@Test
public void availableReportsTest() {
    Set<IPrintableReport> reports = printableReportsRegistry.availableReports();
    for (IPrintableReport report : reports) {
        if (report.getName().equals("ConsentReport")) {
            Assert.assertEquals(ready, report.isReady());
            Assert.assertEquals(notLocalisble, report.isLocalisable());
            Assert.assertEquals(0, report.availableLocales().size());
            return;
        }//from  w  w  w  .  j a  v a2 s . c  om
    }
    Assert.assertFalse("Expected to find the 'ConsentReport'", true);
}

From source file:de.odysseus.staxon.json.stream.jackson.JacksonStreamTargetTest.java

@Test
public void testArray1() throws IOException {
    StringWriter writer = new StringWriter();
    JacksonStreamTarget target = new JacksonStreamTarget(new JsonFactory().createGenerator(writer));

    target.startObject();/*from   w  w  w.j a  va2 s .  c o  m*/
    target.name("alice");
    target.startArray();
    target.value("bob");
    target.endArray();
    target.endObject();

    target.close();

    Assert.assertEquals("{\"alice\":[\"bob\"]}", writer.toString());
}

From source file:com.mirth.connect.plugins.datatypes.hl7v2.test.HL7SerializerTest.java

@Test
public void testFromXmlDefault() throws Exception {
    String input = FileUtils.readFileToString(new File("tests/test-hl7-output.xml"));
    String output = FileUtils.readFileToString(new File("tests/test-hl7-input.txt"));
    ER7Serializer serializer = new ER7Serializer(defaultProperties.getSerializerProperties());
    Assert.assertEquals(output, TestUtil.convertCRToCRLF(serializer.fromXML(input)));
}

From source file:org.atemsource.atem.impl.dynamic.DynamicEntityTypeImplTest.java

@Test
public void testString() {
    EntityTypeBuilder builder = repository.createBuilder("test");
    SingleAttribute<String> attribute = builder.addSingleAttribute("text", String.class);
    EntityType<?> entityType = builder.createEntityType();

    Object entity = entityType.createEntity();
    attribute.setValue(entity, "hallo");
    Assert.assertEquals("hallo", attribute.getValue(entity));
}

From source file:org.openmrs.contrib.metadatarepository.service.PackageManagerTest.java

@Test
public void testSearchByUser() throws Exception {
    User user = umagr.getUserByUsername("admin");
    String query = "";

    List<MetadataPackage> searchByUser = magr.searchByUser(query, user);
    Assert.assertEquals(1, searchByUser.size());
}

From source file:ejportal.webapp.action.SignupActionTest.java

/**
 * Test display form./*w  w w.j  av  a2 s  .  co  m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testDisplayForm() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest(null, "GET", "/signup.html");
    ServletActionContext.setRequest(request);
    Assert.assertEquals("input", this.action.execute());
}

From source file:com.ibm.mobilefirstplatform.clientsdk.android.security.mca.internal.security.AuthorizationPreferencesTests.java

public void testJSONSaving() throws Exception {

    preferences.userIdentity.set(saveJSON);

    AuthorizationManagerPreferences preferences3 = new AuthorizationManagerPreferences(
            getInstrumentation().getTargetContext());

    JSONObject result = new JSONObject(preferences3.userIdentity.getAsMap());
    Assert.assertEquals("TestValue", result.getString("TestName"));
}