Example usage for junit.framework Assert assertNotNull

List of usage examples for junit.framework Assert assertNotNull

Introduction

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

Prototype

static public void assertNotNull(Object object) 

Source Link

Document

Asserts that an object isn't null.

Usage

From source file:org.obiba.onyx.core.service.impl.ConfigurablePasswordValidationStrategyImplTest.java

@Test
public void testValidatePasswordReturnsList() {
    ((ConfigurablePasswordValidationStrategyImpl) passwordStrategy).setMinimumCharacterGroupsUsage(1);
    List<MessageSourceResolvable> messageList = passwordStrategy.validatePassword(user, "password");
    Assert.assertNotNull(messageList);
    Assert.assertTrue(messageList.size() == 0); // No error messages. Passed.
}

From source file:org.web4thejob.orm.ListSerializationTest.java

@Test
public void localesListTest() throws IOException {
    final Marshaller marshaller = ContextUtil.getBean(Marshaller.class);
    Assert.assertNotNull(marshaller);

    List<Locale> locales = new ArrayList<Locale>();
    locales.add(Locale.CANADA);//from ww  w.  j a  va2s.c  o  m
    locales.add(Locale.CHINA);
    locales.add(Locale.ENGLISH);

    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    final Result result = new StreamResult(out);
    marshaller.marshal(locales, result);
    System.out.println(out.toString("UTF-8"));

}

From source file:com.cloudant.sync.datastore.BasicDBBodyTest.java

@Test
public void constructor_byteArray_correctObjectShouldBeCreated() throws Exception {
    DocumentBody body = new BasicDocumentBody(jsonData);
    Assert.assertTrue(Arrays.equals(jsonData, body.asBytes()));
    Assert.assertNotNull(body.asMap());

    Map<String, Object> actualMap = body.asMap();
    assertMapIsCorrect(actualMap);/*  w ww.j  a  va2 s.co m*/
}

From source file:org.openmrs.module.formfilter.web.controller.AddFormFilterPropertyControllerTest.java

/**
 * @see {@link AddFormFilterPropertyController#addFormFilter(ModelMap, Integer, int)}
 */// w w  w.  j a  v  a 2  s  .c o m
@Test
@Verifies(value = "should support add new filter functionality", method = "addFormFilter(ModelMap,Integer,int)")
public void addFormFilter_shouldSupportAddNewFilterFunctionality() {

    AddFormFilterPropertyController controller = new AddFormFilterPropertyController();
    ModelMap model = new ModelMap();
    controller.addFormFilter(model, 1, null);
    Assert.assertNotNull(((FormFilter) model.get("formFilter")));
    Assert.assertNull(((FormFilterProperty) model.get("formFilterProperty")).getFilterName());
}

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

@Test
public void saveForm_shouldSaveForm() throws Exception {
    final String formName = "FormName";

    List<FormDef> forms = studyManagerService.getForms();
    Assert.assertNotNull(forms);
    int numberOfForms = forms.size();

    FormDef form = new FormDef();
    form.setName(formName);//from   www  .  ja  v  a 2  s  .com
    form.setCreator(userService.getUsers().get(0));
    form.setDateCreated(new Date());

    studyManagerService.saveForm(form);

    forms = studyManagerService.getForms();
    Assert.assertEquals("Added one form", (numberOfForms + 1), forms.size());
    Assert.assertNotNull(getForm(formName, forms));
}

From source file:io.cloudslang.lang.compiler.PreCompileTransformersTest.java

@Test
public void testOpInvalidInput() throws Exception {
    URI resource = getClass().getResource("/corrupted/transformers/operation_input_private_no_default.sl")
            .toURI();/*from   w w w  .  j a  va  2  s  . c o  m*/
    ExecutableModellingResult result = compiler.preCompileSource(SlangSource.fromFile(resource));

    Assert.assertNotNull(result);

    Executable executable = result.getExecutable();
    Assert.assertNotNull(executable);
    List<Input> inputs = executable.getInputs();
    Assert.assertEquals(6, inputs.size());

    List<RuntimeException> errors = result.getErrors();
    Assert.assertNotNull(errors);
    Assert.assertTrue(errors.size() > 0);
    exception.expect(RuntimeException.class);
    exception.expectMessage("For operation 'operation_input_private_no_default' syntax is illegal.");
    exception.expectMessage(
            "Input: 'input_private_no_default' is private and required but no default value was specified");
    throw errors.get(0);
}

From source file:org.codehaus.grepo.query.hibernate.generator.GeneratorRepositoryTest.java

@Test
public void testWithCriteriaGenerator() {
    Assert.assertNotNull(repo.getWithCriteriaGenerator("username", "xyz"));
}

From source file:org.jrecruiter.service.UserServiceTest.java

@Test
public void testAddUserTest() {

    final User user = getUser();
    final User user2 = getUser();

    try {/*from  w  ww .  j av a  2  s  .  com*/
        userService.addUser(user);
        entityManager.flush();
    } catch (DuplicateUserException e) {
        Assert.fail();
    }
    try {
        userService.addUser(user2);
        entityManager.flush();
    } catch (DuplicateUserException e) {
        Assert.assertNotNull(e.getMessage());
        return;
    }
    Assert.fail();
}

From source file:com.ancientprogramming.fixedformat4j.format.impl.TestNullableFixedFormatManagerImpl.java

public void testLoadNonNullRecord() {
    MyNullableRecord loadedRecord = manager.load(MyNullableRecord.class, MY_NONNULL_RECORD_DATA);
    Assert.assertNotNull(loadedRecord);
    Assert.assertEquals("", loadedRecord.getStringData());
    Assert.assertTrue(loadedRecord.isBooleanData());
}

From source file:com.ancientprogramming.fixedformat4j.format.impl.TestFixedFormatManagerImpl.java

public void testLoadRecord() {
    MyRecord loadedRecord = manager.load(MyRecord.class, MY_RECORD_DATA);
    Assert.assertNotNull(loadedRecord);
    Assert.assertEquals(STR, loadedRecord.getStringData());
    Assert.assertTrue(loadedRecord.isBooleanData());
}