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(String message, boolean condition) 

Source Link

Document

Asserts that a condition is false.

Usage

From source file:net.sf.dynamicreports.test.jasper.chart.GroupedStackedBarChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);/*from www. j  a  v  a 2s .  com*/

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", GroupedStackedBarRenderer.class, categoryPlot.getRenderer().getClass());
    Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible());
    Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickLabelsVisible());
    Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickMarksVisible());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getCategoryPlot().getDomainAxis();
    Assert.assertEquals("category label", "category", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions()
            .getLabelPosition(RectangleEdge.LEFT);
    Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart3", 0);
    axis = chart.getCategoryPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
}

From source file:net.sf.dynamicreports.test.jasper.chart.LayeredBarChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);/*from   w  w w  .ja  v  a  2  s  . c  om*/

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", LayeredBarRenderer.class, categoryPlot.getRenderer().getClass());
    Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible());
    Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible());
    Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getCategoryPlot().getDomainAxis();
    Assert.assertEquals("category label", "category", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions()
            .getLabelPosition(RectangleEdge.LEFT);
    Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart3", 0);
    axis = chart.getCategoryPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
}

From source file:de.hybris.platform.jobs.RemovedItemPKProcessorTest.java

@Test
public void testAllIterated() {
    final PK one = PK.createFixedUUIDPK(102, 1);
    final PK two = PK.createFixedUUIDPK(102, 2);
    final PK three = PK.createFixedUUIDPK(102, 3);

    final MediaModel mediaPk = new MediaModel();
    final DataInputStream dis = new DataInputStream(buildUpStream(one, two, three));

    Mockito.when(model.getItemPKs()).thenReturn(mediaPk);
    Mockito.when(mediaService.getStreamFromMedia(mediaPk)).thenReturn(dis);

    iterator.init(model);/*from   w  w  w.ja va  2 s  .c o m*/

    Assert.assertTrue("Not all iterations should be skipped ", iterator.hasNext());
    Assert.assertEquals("Should  return first element ", one, iterator.next());
    Assert.assertTrue("Not all iterations should be skipped ", iterator.hasNext());
    Assert.assertEquals("Should  return second element ", two, iterator.next());
    Assert.assertTrue("Not all iterations should be skipped ", iterator.hasNext());
    Assert.assertEquals("Should  return third element ", three, iterator.next());
    Assert.assertFalse("Now all iterations should be skipped ", iterator.hasNext());
}

From source file:net.sf.dynamicreports.test.jasper.chart.DifferenceChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);//from  w w  w  . ja v a 2  s .  co  m

    JFreeChart chart = getChart("summary.chart1", 0);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    Assert.assertEquals("renderer", XYDifferenceRenderer.class, renderer.getClass());
    Assert.assertFalse("show shapes", ((XYDifferenceRenderer) renderer).getShapesVisible());
    Assert.assertEquals("positive paint", Color.BLUE, ((XYDifferenceRenderer) renderer).getPositivePaint());
    Assert.assertEquals("negative paint", Color.MAGENTA, ((XYDifferenceRenderer) renderer).getNegativePaint());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getXYPlot().getDomainAxis();
    Assert.assertEquals("category label", "time", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());

    chart = getChart("summary.chart3", 0);
    axis = chart.getXYPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    //Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
    Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());
}

From source file:org.springsource.examples.expenses.TestDatabaseExpenseReportingService.java

@Test
public void testValidation() throws Throwable {
    // create a report
    Long erId = reportingService.createNewReport(this.purpose);
    Assert.assertNotNull(erId);//w w  w .ja va2  s  . c  om
    // add expenses, one valid, one invalid
    List<Expense> expenses = reportingService.addExpenses(erId, this.charges);
    Assert.assertEquals(expenses.size(), this.charges.size());

    FilingResult filingResultStatus = reportingService.fileReport(erId);
    Expense found = null;
    for (Expense e : filingResultStatus.getExpenseReport().getExpenses()) {
        if (e.isFlagged()) {
            found = e;
        }
    }
    Assert.assertNotNull(found); // we know that ONE of them is invalid
    Assert.assertTrue(filingResultStatus.getStatus().equals(FilingResultStatus.VALIDATION_ERROR));
    Assert.assertTrue(found.isFlagged());
    Assert.assertFalse("the message returned should not be null", StringUtils.isEmpty(found.getFlag()));
}

From source file:de.hybris.platform.jobs.RemovedItemPKProcessorTest.java

@Test
public void testNotAllSkipofDeletedAndRefused() {
    final PK one = PK.createFixedUUIDPK(102, 1);
    final PK two = PK.createFixedUUIDPK(102, 2);
    final PK three = PK.createFixedUUIDPK(102, 3);

    final MediaModel mediaPk = new MediaModel();
    final DataInputStream dis = new DataInputStream(buildUpStream(one, two, three));

    Mockito.when(model.getItemPKs()).thenReturn(mediaPk);
    Mockito.when(mediaService.getStreamFromMedia(mediaPk)).thenReturn(dis);
    Mockito.when(model.getItemsRefused()).thenReturn(Integer.valueOf(1));
    Mockito.when(model.getItemsDeleted()).thenReturn(Integer.valueOf(1));

    iterator.init(model);//w  ww.ja v a2  s .c o  m

    Assert.assertTrue("Not all iterations should be skipped ", iterator.hasNext());
    Assert.assertEquals("Should only return last element ", three, iterator.next());
    Assert.assertFalse("Now all iterations should be skipped ", iterator.hasNext());
}

From source file:com.streamreduce.core.service.EmailServiceImplTest.java

@Test
public void testSendInsightsAvailableEmail() throws Exception {
    ArgumentCaptor<SendEmailRequest> captor = ArgumentCaptor.forClass(SendEmailRequest.class);
    emailService.sendInsightsAvailableEmail(Arrays.asList(testUser));
    verify(mockAmazonSimpleEmailServiceClient).sendEmail(captor.capture());
    // WEEEEEEEEEEEEEEEEEEEEEEEEEEEE!
    Body body = captor.getValue().getMessage().getBody();
    Assert.assertFalse("Encountered unexpanded template token.", body.getHtml().getData().contains("${"));
    Assert.assertFalse("Encountered unexpanded template token.", body.getText().getData().contains("${"));
}

From source file:org.jboss.as.test.clustering.cluster.web.passivation.SessionPassivationAbstractCase.java

/**
 * Test that session is not passivated before minimum idle time (passivation-min-idle-time) is reached.
 *
 * @throws Exception//  w w  w.jav a 2  s.c  om
 */
@Test
public void testSessionPassivationWithMinIdleTime(
        @ArquillianResource @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1) throws Exception {

    // Create an instance of HttpClient
    HttpClient client = HttpClientUtils.relaxedCookieHttpClient();

    try {
        // Setup the session
        HttpResponse response = ClusterHttpClientUtil.tryGet(client, baseURL1 + SimpleServlet.URL);
        Assert.assertFalse("Session should not be serialized",
                Boolean.valueOf(response.getFirstHeader(SimpleServlet.HEADER_SERIALIZED).getValue()));
        response.getEntity().getContent().close();

        // Sleep for less than passivation-min-idle-time
        Thread.sleep(PASSIVATION_MIN_IDLE_TIME * 1000 - 100);

        // Make sure the session hasn't passivated already
        response = ClusterHttpClientUtil.tryGet(client, baseURL1 + SimpleServlet.URL);
        Assert.assertFalse("Session should not have been passivated",
                Boolean.valueOf(response.getFirstHeader(SimpleServlet.HEADER_SERIALIZED).getValue()));
        Assert.assertEquals(2, Integer.parseInt(response.getFirstHeader("value").getValue()));
        response.getEntity().getContent().close();
    } finally {
        client.getConnectionManager().shutdown();
    }
}

From source file:com.atlassian.jira.rest.client.TestUtil.java

public static <E> void assertNotEquals(E a, E b) {
    if (a == null) {
        Assert.assertFalse("[" + a + "] not equals [" + b + "]", b.equals(a));
    } else if (b == null) {
        Assert.assertFalse("[" + a + "] not equals [" + b + "]", a.equals(b));
    } else if (a.equals(b) || b.equals(a)) {
        Assert.fail("[" + a + "] not equals [" + b + "]");
    }//  www .  j  a v a2s.  c o m
}