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:com.taobao.ad.jpa.test.JobUserSubTest.java

@Test
public void getUserSub() {

    JobUserSubDO sub = new JobUserSubDO();
    sub.setJobGroup("110");
    sub.setJobName("dtJustTest");
    sub.setUserId(2L);//from w  w  w. jav a  2  s. c o m
    sub.setType(0);
    sub = jobUserSubBO.getUserSub(sub);

    Assert.assertNotNull(sub);
    Assert.assertEquals("110", sub.getJobGroup());
    Assert.assertEquals("dtJustTest", sub.getJobName());
    Assert.assertEquals(2L, sub.getUserId().longValue());
    Assert.assertEquals(0, sub.getType());
    Assert.assertEquals(1, sub.getWangwang());
    Assert.assertEquals(1, sub.getEmail());
    Assert.assertEquals(1, sub.getMobile());
}

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

@Test
public void testValidatePasswordReturnsList() {
    List<MessageSourceResolvable> messageList = anyPasswordStrategy.validatePassword(user, "password");
    Assert.assertNotNull(messageList);
    Assert.assertEquals(0, messageList.size()); // Zero messages. Always valid.
}

From source file:com.taobao.ad.jpa.test.RepeatAlarmTest.java

@Test
public void testGetReapeatAlermById() {
    RepeatAlarmDO r = repeatAlarmBO.getRepeatAlarmById(1);

    Assert.assertNotNull(r);
    Assert.assertEquals(1, r.getId().intValue());
    Assert.assertEquals("11", r.getJobName());
    Assert.assertEquals("11", r.getJobGroup());
    Assert.assertEquals(1111, r.getSignTime());
    Assert.assertEquals(11, r.getRepeatAlarmNum());
    Assert.assertEquals(1, r.getStatus().intValue());
}

From source file:org.os890.test.ds.addon.spring.CdiToSpringTest.java

@Test
public void springLookupTest() {
    Assert.assertNotNull(this.applicationContext.getBean(SingletonSpringBean.class));
    Assert.assertNotNull(this.applicationContext.getBean(ApplicationScopedCdiBean.class));
}

From source file:org.crsh.spring.SpringTestCase.java

public void testFoo() throws Exception {

    URL xml = SpringTestCase.class.getResource("spring.xml");
    Assert.assertNotNull(xml);

    ////ww w.j a v a  2s  .  c o  m
    GenericXmlApplicationContext context = new GenericXmlApplicationContext(new UrlResource(xml));
    context.start();

    //
    SpringBootstrap bootstrap = context.getBean(SpringBootstrap.class);

    // Test a bit
    ShellFactory factory = bootstrap.getContext().getPlugin(ShellFactory.class);
    Shell shell = factory.create(null);
    assertNotNull(shell);
    ShellProcess process = shell.createProcess("foo_cmd");
    assertNotNull(process);
    BaseProcessContext pc = BaseProcessContext.create(process).execute();
    assertTrue(pc.getResponse() instanceof ShellResponse.Ok);
    String r = pc.getOutput();
    assertEquals("bar", r);
}

From source file:org.apache.sling.etcd.client.impl.EtcdClientFactoryImplTest.java

@Test
public void testCreate() throws Exception {
    CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class);
    EtcdClientFactory factory = new EtcdClientFactoryImpl();
    EtcdClient client = factory.create(httpClient, new URI("localhost:4001"));
    Assert.assertNotNull(client);
}

From source file:com.googlecode.flickrandroid.oauth.test.OAuthTest.java

@Test
public void testGetRequestToken() throws IOException, FlickrException {
    OAuthToken token = f.getOAuthInterface().getRequestToken("http://localhost:8080"); //$NON-NLS-1$
    Assert.assertNotNull(token);
    URL url = f.getOAuthInterface().buildAuthenticationUrl(Permission.READ, token);
    System.out.println("OAuth URL: " + url); //$NON-NLS-1$
    Assert.assertNotNull(url);//from  w w  w  .java 2 s. c  o  m
}

From source file:org.atemsource.atem.impl.pojo.ScannedPojoRepositoryTest.java

@Test
public void testTypes() {
    EntityType<EntityA> entityType = entityTypeRepository.getEntityType(EntityA.class);
    Assert.assertNotNull(entityType);
    Assert.assertNotNull(entityType.getSubEntityTypes(true));
    Assert.assertEquals(1, entityType.getSubEntityTypes(true).size());
    Assert.assertEquals(5, entityType.getDeclaredAttributes().size());
    Assert.assertNotNull(entityType.getAttribute("list").getTargetType());

}

From source file:org.tritsch.android.chargefinder.CFService.java

/**
 * <code>lockup<code> will contact the chargefinder service and will retrieve
 * a/the list of stations described by the parameters.
 *
 * @param pointX - x coordinates to start the search from
 * @param pointY - y coordinates to start the search from
 * @param radius - the radius from x, y to include in the search
 *
 * @return a/the list of stations that are within the radius
 *///ww  w.j av a2s  .  co m
public static List<CFStation> lookup(final String pointX, final String pointY, final String radius) {
    if (Log.isLoggable(TAG, Log.DEBUG))
        Log.d(TAG, "Enter: lookup()");
    Assert.assertNotNull(pointX);
    Assert.assertFalse(pointX.length() == 0);
    Assert.assertNotNull(pointY);
    Assert.assertFalse(pointY.length() == 0);
    Assert.assertNotNull(radius);
    Assert.assertFalse(radius.length() == 0);

    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "pointX:" + pointX);
    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "pointY:" + pointY);
    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "radius:" + radius);

    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "create the list we will return ...");
    List<CFStation> stations = new ArrayList<CFStation>();

    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "create http client ...");
    HttpClient httpClient = new DefaultHttpClient();
    Assert.assertNotNull(httpClient);

    String url = "" + BASE_URL + "?point_x=" + pointX + "&point_y=" + pointY + "&radius=" + radius;
    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "URL:" + url);

    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "go and do it ...");
    HttpResponse response = null;
    try {
        response = httpClient.execute(new HttpGet(url));
        Assert.assertNotNull(response);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail();
    }

    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "process response ...");
    JSONArray stationsObject = null;
    try {
        HttpEntity entity = response.getEntity();
        Assert.assertNotNull(entity);

        String resultString = getString(entity.getContent());
        Assert.assertNotNull(resultString);
        if (Log.isLoggable(TAG, Log.VERBOSE))
            Log.v(TAG, "Result:" + resultString);

        JSONObject resultObject = new JSONObject(resultString);
        Assert.assertNotNull(resultObject);

        stationsObject = resultObject.getJSONArray("stations");
        Assert.assertNotNull(stationsObject);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail();
    }

    if (Log.isLoggable(TAG, Log.VERBOSE))
        Log.v(TAG, "build list of stations ...");
    try {
        for (int i = 0; i < stationsObject.length(); i++) {
            JSONObject station = stationsObject.getJSONObject(i);
            Assert.assertNotNull(station);

            CFStation newStation = new CFStation();
            newStation.setName(station.getString("name"));
            newStation.setX(station.getDouble("st_x"));
            newStation.setY(station.getDouble("st_y"));

            Assert.assertTrue(stations.add(newStation));
        }
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail();
    }

    if (Log.isLoggable(TAG, Log.DEBUG))
        Log.d(TAG, "Leave: lookup()");
    return stations;
}

From source file:com.indoqa.maven.wadldoc.transformation.Wadl2HtmlPipelineTest.java

@Test
public void simplePipeline() throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    new Wadl2HtmlPipeline(this.getClass().getResource("wadl.xml"), null, true).execute(baos);

    Assert.assertNotNull(baos);
    Diff diff = createDiff("test1-result.html", baos);
    Assert.assertTrue("Pieces of XML are not identical. " + diff, diff.identical());
}