Example usage for junit.framework Assert assertTrue

List of usage examples for junit.framework Assert assertTrue

Introduction

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

Prototype

static public void assertTrue(boolean condition) 

Source Link

Document

Asserts that a condition is true.

Usage

From source file:org.ocpsoft.rewrite.servlet.config.EncodeQueryConfigurationTest.java

@Test
public void testQueryEncoding() throws Exception {
    HttpAction<HttpGet> action = get("/encodequery?foo=bar");
    Assert.assertEquals(210, action.getResponse().getStatusLine().getStatusCode());
    Assert.assertTrue(action.getCurrentContextRelativeURL().contains("/encodequery?c="));
}

From source file:com.ning.metrics.collector.processing.db.CollectorMysqlTestingHelper.java

public void startMysql() throws IOException {
    ServerSocket socket = new ServerSocket(0);

    port = socket.getLocalPort();/*from w w  w  .ja va  2s.c  om*/
    socket.close();

    dbDir = File.createTempFile("mysqldb", ".db");
    Assert.assertTrue(dbDir.delete());
    Assert.assertTrue(dbDir.mkdir());

    mysqldResource = new MysqldResource(dbDir);

    Map<String, String> dbOpts = new HashMap<String, String>();

    dbOpts.put(MysqldResourceI.PORT, Integer.toString(port));
    dbOpts.put(MysqldResourceI.INITIALIZE_USER, "true");
    dbOpts.put(MysqldResourceI.INITIALIZE_USER_NAME, USERNAME);
    dbOpts.put(MysqldResourceI.INITIALIZE_PASSWORD, PASSWORD);

    mysqldResource.start("test-mysqld-thread", dbOpts);

    if (!mysqldResource.isRunning()) {
        throw new IllegalStateException("MySQL did not start.");
    }
}

From source file:com.tamnd.app.jpa.AccountJPATest.java

@Test
@Transactional
public void testFind() {
    Assert.assertNotNull(repo.findAccount(account.getUserId()));
    Assert.assertTrue(repo.findAccount(account.getUserId()).getUserRole().size() > 0);
}

From source file:eagle.security.userprofile.model.UserProfileEigenModelerTest.java

@org.junit.Test
public void testBuild() throws Exception {

    UserProfileEigenModeler modeler = new UserProfileEigenModeler();
    String user = "user1";
    final RealMatrix mockMatrix = new Array2DRowRealMatrix(buildMockData());
    List<UserProfileEigenModel> model = modeler.build("default", user, mockMatrix);
    Assert.assertEquals(model.length(), 1);

    UserProfileEigenModel eigenModel = model.head();
    Assert.assertNotNull(eigenModel.statistics());
    Assert.assertNotNull(eigenModel.principalComponents());
    Assert.assertNotNull(eigenModel.maxVector());
    Assert.assertNotNull(eigenModel.minVector());
    Assert.assertEquals(eigenModel.statistics().length, mockMatrix.getColumnDimension());
    Assert.assertTrue(eigenModel.principalComponents().length <= mockMatrix.getColumnDimension());
    Assert.assertTrue(eigenModel.maxVector().getDimension() <= mockMatrix.getColumnDimension());
    Assert.assertTrue(eigenModel.minVector().getDimension() <= mockMatrix.getColumnDimension());
    Assert.assertEquals(true, eigenModel.statistics()[3].isLowVariant());
}

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

@Test
public void getTasks_shouldReturnAllTasks() throws Exception {
    List<TaskDef> tasks = tasksService.getTasks();

    Assert.assertNotNull(tasks);/*from   w  ww.  jav a  2  s. c  om*/
    Assert.assertEquals(3, tasks.size());

    for (TaskDef taskDef : tasks) {
        String name = taskDef.getName();
        Assert.assertTrue(
                name.equals("Forms Bluetooth") || name.equals("Data Export") || name.equals("Forms SMS"));
    }
}

From source file:org.ocpsoft.rewrite.faces.resolver.FacesBeanNameResolverTest.java

@Test
public void testFacesBeanNameResolverFeatures() throws Exception {
    HttpAction<HttpGet> action = get("/name/christian");
    Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode());
    Assert.assertTrue(action.getResponseContent().contains("Name = [christian]"));
    Assert.assertTrue(action.getResponseContent().contains("Uppercase = [CHRISTIAN]"));
}

From source file:org.obiba.onyx.core.domain.participant.ParticipantAttributeReaderTest.java

@Test
public void testThatDefaultEmptyGroupExists() {
    for (ParticipantAttribute participantAttribute : participantAttributes) {
        if (participantAttribute.getGroup().getName().equals(Group.DEFAULT_GROUP_NAME)) {
            Assert.assertTrue(true);
            return;
        }/*from w w  w .  j  a v  a2  s  .c o m*/
    }
    Assert.assertFalse("At least one group was not a default group.", true);
}

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

public void testLoadNullableRecord() {
    MyNullableRecord loadedRecord = manager.load(MyNullableRecord.class, MY_NULLABLE_RECORD_DATA);
    Assert.assertNotNull(loadedRecord);//  w ww .ja va  2s.co m
    Assert.assertEquals(null, loadedRecord.getStringData());
    Assert.assertTrue(loadedRecord.isBooleanData());
}

From source file:BQJDBC.QueryResultTest.BQForwardOnlyResultSetFunctionTest.java

@Test
public void ChainedCursorFunctionTest() {
    this.logger.info("ChainedFunctionTest");
    try {// www.j a va2s  .  co  m
        Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next());
        Assert.assertEquals("you", BQForwardOnlyResultSetFunctionTest.Result.getString(1));

    } catch (SQLException e) {
        this.logger.error("SQLexception" + e.toString());
        Assert.fail("SQLException" + e.toString());
    }
    try {
        BQForwardOnlyResultSetFunctionTest.Result.absolute(10);
    } catch (SQLException e) {
        Assert.assertTrue(true);
    }

    try {
        for (int i = 0; i < 9; i++) {
            Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next());
        }
        Assert.assertFalse(BQForwardOnlyResultSetFunctionTest.Result.next());
    } catch (SQLException e) {
        this.logger.error("SQLexception" + e.toString());
        Assert.fail("SQLException" + e.toString());
    }

    try {
        Assert.assertEquals("", BQForwardOnlyResultSetFunctionTest.Result.getString(1));
    } catch (SQLException e) {
        Assert.assertTrue(true);
    }

    QueryLoad();
    try {
        Result.next();
        Assert.assertEquals("you", BQForwardOnlyResultSetFunctionTest.Result.getString(1));
    } catch (SQLException e) {
        this.logger.error("SQLexception" + e.toString());
        Assert.fail("SQLException" + e.toString());
    }
    this.logger.info("chainedfunctiontest end");
}

From source file:com.github.neoio.net.message.staging.memory.TestMemoryMessageStaging.java

@Test
public void test_tempWrite() {
    ByteBuffer buffer = ByteBuffer.allocate(1024);

    buffer.put("Hello World".getBytes());
    buffer.rewind();/*from w  w w . j  a  v a2 s  . c  om*/
    staging.writeTempWriteBytes(buffer);
    Assert.assertTrue(staging.hasTempWriteBytes());

    buffer.clear();
    staging.readTempWriteBytes(buffer);
    Assert.assertEquals("Hello World",
            new String(ArrayUtils.subarray(buffer.array(), 0, "Hello World".getBytes().length)));
    staging.resetTempWriteBytes();

    Assert.assertFalse(staging.hasTempWriteBytes());
}