Example usage for junit.framework Assert assertFalse

List of usage examples for junit.framework Assert assertFalse

Introduction

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

Prototype

static public void assertFalse(boolean condition) 

Source Link

Document

Asserts that a condition is false.

Usage

From source file:io.cloudslang.lang.runtime.navigations.NavigationsTest.java

@Test
public void errorNavigationTest() throws Exception {

    RunEnvironment runEnv = new RunEnvironment();
    Long nextStepId = 2L;//  ww w .j a v  a2s  .  c  om
    runEnv.putNextStepPosition(nextStepId);
    ExecutionRuntimeServices runtimeServices = new ExecutionRuntimeServices();
    runtimeServices.setStepErrorKey("Error");
    try {
        Long nextPosition = navigations.navigate(runEnv, runtimeServices);

    } catch (RuntimeException e) {
        Collection<ScoreEvent> events = runtimeServices.getEvents();

        Assert.assertFalse(events.isEmpty());
        ScoreEvent stepErrorEvent = null;
        for (ScoreEvent event : events) {
            if (event.getEventType().equals(ScoreLangConstants.SLANG_EXECUTION_EXCEPTION)) {
                stepErrorEvent = event;
            }
        }
        Assert.assertNotNull(stepErrorEvent);
    }

}

From source file:im.tym.wraop.both.SpringAOPWrapperFactorySpiTest.java

@Test
public void testAddNonAspect() {
    Assert.assertFalse(factory.addAspect(this));
}

From source file:fr.msch.wissl.server.TServer.java

@Before
public void setUp() throws Exception {
    startServer();//from  ww w  .  j a  v a 2s . c o m

    Assert.assertFalse(hasUsers());

    // create admin-level user
    String ret = this.addUser(admin_username, admin_password, "1", null);
    JSONObject o = new JSONObject(ret);
    JSONObject user = o.getJSONObject("user");
    this.admin_userId = user.getInt("id");
    Assert.assertEquals(this.admin_username, user.getString("username"));

    // login admin
    ret = this.login(admin_username, admin_password);
    o = new JSONObject(ret);
    Assert.assertEquals(this.admin_userId, o.getInt("userId"));
    this.admin_sessionId = o.getString("sessionId");

    // create user-level user
    ret = this.addUser(user_username, user_password, "2", admin_sessionId);
    o = new JSONObject(ret);
    user = o.getJSONObject("user");
    this.user_userId = user.getInt("id");
    Assert.assertEquals(this.user_username, user.getString("username"));

    // login user
    ret = this.login(user_username, user_password);
    o = new JSONObject(ret);
    Assert.assertEquals(this.user_userId, o.getInt("userId"));
    this.user_sessionId = o.getString("sessionId");

    Assert.assertTrue(hasUsers());
}

From source file:org.esigate.DriverCookieTest.java

/**
 * Ensure Secure attribute is kept is connection uses https.
 * /*from w w  w .j  av a  2  s . c  o m*/
 * @throws Exception
 */
public void testSecure() throws Exception {

    // Conf
    Properties properties = new Properties();
    properties.put(Parameters.REMOTE_URL_BASE.getName(), "http://provider/");

    // Setup remote server (provider) response.
    Driver driver = TestUtils.createMockDriver(properties, new IResponseHandler() {
        @Override
        public HttpResponse execute(HttpRequest request) throws IOException {
            return TestUtils.createHttpResponse().status(HttpStatus.SC_OK).reason("OK")
                    .header("Set-Cookie", "testcookie=testvalue; Secure").entity("test").build();
        }
    });

    // Https request : Cookie is forwarded as Secure
    IncomingRequest request = TestUtils.createRequest("https://test.mydomain.fr/foobar/").build();

    TestUtils.driverProxy(driver, request);
    Assert.assertTrue(((ClientCookie) request.getNewCookies()[0]).isSecure());

    // Http request : Cookie is forwarded as NOT secure
    request = TestUtils.createRequest("http://test.mydomain.fr/foobar/").build();
    TestUtils.driverProxy(driver, request);
    Assert.assertFalse(((ClientCookie) request.getNewCookies()[0]).isSecure());
}

From source file:com.liferay.mobile.push.ReceivePushNotificationTest.java

@Test
public void isReceiverRegistered() throws Exception {
    ShadowApplication app = Robolectric.getShadowApplication();

    List<Wrapper> wrappers = app.getRegisteredReceivers();

    Assert.assertFalse(wrappers.isEmpty());

    BroadcastReceiver receiver = null;/*www .j a v a2  s  .  c om*/

    for (Wrapper wrapper : wrappers) {
        if (wrapper.broadcastReceiver instanceof PushNotificationsReceiver) {

            receiver = wrapper.broadcastReceiver;
        }
    }

    Assert.assertNotNull(receiver);
}

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

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

    buffer.put("Hello World".getBytes());
    buffer.flip();//  w ww.  ja  v  a  2s  .  c  o m
    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());
}

From source file:com.currencyfair.minfraud.MinFraudImplTest.java

@Test
public void testRiskScoreResponseIsExtractedFromValidHttpResponse() throws Exception {
    StringEntity responseEntity = new StringEntity(VALID_RESPONSE, ContentType.TEXT_PLAIN);
    HttpMethodFactory methodFactory = expectCreateHttpPost();
    CloseableHttpResponse httpResponse = EasyMock.createMock(CloseableHttpResponse.class);
    expectHttpResponse(httpResponse, 200, responseEntity);
    expectClose(httpResponse, null);// w  w  w .j a v  a 2 s. co  m
    HttpClient client = expectHttpInvocation(httpResponse);
    EasyMock.replay(httpResponse);
    minFraudImpl.setHttpClient(client);
    minFraudImpl.setMethodFactory(methodFactory);
    minFraudImpl.setEndpoint(ENDPOINT);
    RiskScoreResponse response = minFraudImpl.calculateRisk(newRiskScoreRequest());
    Assert.assertNotNull(response);
    Assert.assertEquals(new BigDecimal("23.2"), response.getRiskScore());
    Assert.assertTrue(response.getGeoIpDetails().isCountryMatch());
    Assert.assertFalse(response.getGeoIpDetails().isHighRiskCountry());
    Assert.assertEquals("IE", response.getGeoIpDetails().getIpCountryCode());
    Assert.assertEquals(Integer.valueOf(48), response.getGeoIpDetails().getDistance());
    EasyMock.verify(httpResponse);
}

From source file:de.itsvs.cwtrpc.controller.config.RemoteServiceControllerConfigBeanDefinitionParserTest.java

@Test
public void test1() {
    RemoteServiceControllerConfig config;

    config = appContext.getBean("serviceController100", RemoteServiceControllerConfig.class);
    Assert.assertEquals(1, config.getServiceModuleConfigs().size());
    Assert.assertEquals("myModule700", config.getServiceModuleConfigs().iterator().next().getName());
    Assert.assertTrue(config.getResponseCompressionEnabled());
    Assert.assertFalse(config.getRpcTokenProtectionEnabled());
    Assert.assertEquals("rpcTokenService", config.getRpcTokenValidatorName());
    Assert.assertSame(appContext.getBean("serializationPolicyProvider"),
            config.getSerializationPolicyProvider());
}

From source file:BQJDBC.QueryResultTest.BQForwardOnlyResultSetFunctionTest.java

@Test
public void ChainedCursorFunctionTest() {
    this.logger.info("ChainedFunctionTest");
    try {/*  ww  w. jav  a  2 s  .  c  om*/
        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:ejportal.webapp.action.SigelActionTest.java

/**
 * Test edit./*from  w  w  w.  j  a  v a  2 s.  co m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testEdit() throws Exception {
    this.log.debug("testing edit...");
    this.action.setSigelId(1L);
    Assert.assertNull(this.action.getSigel());
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getSigel());
    Assert.assertFalse(this.action.hasActionErrors());
}