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:Project3Test.java

@Test
public void falseTest() {
    Assert.assertFalse("Condition is true", service.getConditionOne());
}

From source file:com.zimbra.qa.unittest.TestSoapFault.java

@Test
public void testSoapFaultTraceIpReveal() throws Exception {
    String batchRequestUrl = TestUtil.getSoapUrl() + "BatchRequest";
    String createAppointmentRequestUrl = TestUtil.getSoapUrl() + "createAppointmentRequest";
    String modifyContactRequestUrl = TestUtil.getSoapUrl() + "ModifyContactRequest";
    String noOpRequestUrl = TestUtil.getSoapUrl() + "NoOpRequest";
    String getMiniCalRequestUrl = TestUtil.getSoapUrl() + "GetMiniCalRequest";

    PostMethod batchRequestMethod = new PostMethod(batchRequestUrl);
    HttpClientUtil.executeMethod(batchRequestMethod);
    String response = batchRequestMethod.getResponseBodyAsString();
    Assert.assertFalse("Trace contains ip address.", response.contains(batchRequestUrl));

    PostMethod createAppointmentRequestMethod = new PostMethod(createAppointmentRequestUrl);
    HttpClientUtil.executeMethod(createAppointmentRequestMethod);
    response = createAppointmentRequestMethod.getResponseBodyAsString();
    Assert.assertFalse("Trace contains ip address.", response.contains(createAppointmentRequestUrl));

    PostMethod modifyContactRequestMethod = new PostMethod(modifyContactRequestUrl);
    HttpClientUtil.executeMethod(modifyContactRequestMethod);
    response = modifyContactRequestMethod.getResponseBodyAsString();
    Assert.assertFalse("Trace contains ip address.", response.contains(modifyContactRequestUrl));

    PostMethod noOpRequestMethod = new PostMethod(noOpRequestUrl);
    HttpClientUtil.executeMethod(noOpRequestMethod);
    response = noOpRequestMethod.getResponseBodyAsString();
    Assert.assertFalse("Trace contains ip address.", response.contains(noOpRequestUrl));

    PostMethod getMiniCalRequestMethod = new PostMethod(getMiniCalRequestUrl);
    HttpClientUtil.executeMethod(getMiniCalRequestMethod);
    response = getMiniCalRequestMethod.getResponseBodyAsString();
    Assert.assertFalse("Trace contains ip address.", response.contains(getMiniCalRequestUrl));
}

From source file:com.cloud.utils.ProcessUtilTest.java

@Test
public void pidCheck() throws ConfigurationException, IOException {
    Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
    FileUtils.writeStringToFile(pidFile, "123456\n");
    ProcessUtil.pidCheck(pidFile.getParent(), pidFile.getName());
    String pidStr = FileUtils.readFileToString(pidFile);
    Assert.assertFalse("pid can not be blank", pidStr.isEmpty());
    int pid = Integer.parseInt(pidStr.trim());
    int maxPid = Integer.parseInt(FileUtils.readFileToString(new File("/proc/sys/kernel/pid_max")).trim());
    Assert.assertTrue(pid <= maxPid);
}

From source file:com.karriem.tp.tddassignment.TDDTestNGTest.java

@Test
public void falsity() {

    Assert.assertFalse("The condition is not false", service.falsity());
}

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);//  ww w  .  j a va2  s . c  o m
            return;
        }
    }
    Assert.assertFalse("At least one group was not a default group.", true);
}

From source file:my.adam.smo.EncryptionTest.java

@Test
public void symetricEncryptionShortMessage() {
    ApplicationContext clientContext = new ClassPathXmlApplicationContext("Context.xml");
    SymmetricEncryptionBox box = clientContext.getBean(SymmetricEncryptionBox.class);
    int plainTextLength = 3;

    byte[] plainText = new byte[plainTextLength];
    random.nextBytes(plainText);//from  w  ww. j  a  v  a 2  s  . c  o m

    byte[] cryptogram = box.encrypt(plainText);
    Assert.assertFalse("plain text leaked!!!", Arrays.equals(plainText,
            Arrays.copyOfRange(cryptogram, SymmetricEncryptionBox.ivLength, cryptogram.length)));

    byte[] decrypted = box.decrypt(cryptogram);
    Assert.assertTrue("unable to decrypt", Arrays.equals(plainText, decrypted));
}

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

@Test
public void testSkipofDeleted() {
    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.getItemsDeleted()).thenReturn(Integer.valueOf(10));

    iterator.init(model);/*from   w w w . j  a v  a 2s . co  m*/

    Assert.assertFalse("All iterations should be skipped ", iterator.hasNext());
}

From source file:org.obiba.onyx.print.impl.DefaultPrintableReportsRegistryTest.java

@Test
public void availableReportsTest() {
    Set<IPrintableReport> reports = printableReportsRegistry.availableReports();
    for (IPrintableReport report : reports) {
        if (report.getName().equals("ConsentReport")) {
            Assert.assertEquals(ready, report.isReady());
            Assert.assertEquals(notLocalisble, report.isLocalisable());
            Assert.assertEquals(0, report.availableLocales().size());
            return;
        }/*from  www.j av  a  2  s .c  o  m*/
    }
    Assert.assertFalse("Expected to find the 'ConsentReport'", true);
}

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

@Test
public void testCreatingManagedFile() throws Throwable {
    InputStream inputStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream(receiptClassPath);

    ManagedFile mf = this.fileService.createManagedFile(243243, "receipt.jpg");
    Assert.assertFalse("the file's not ready", mf.isReady());
    String localPath = fileService.getLocalPathForManagedFile(mf.getId());
    OutputStream outputSteam = new FileOutputStream(localPath);
    IOUtils.copy(inputStream, outputSteam);
    IOUtils.closeQuietly(inputStream);//from w w w.ja va  2s  .c  o  m
    IOUtils.closeQuietly(outputSteam);

    fileService.setManagedFileReady(mf.getId(), true);

    Assert.assertNotNull(mf.getId());

}

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

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

    numberOfPagesTest(1);/*  w w w  .  j  a  v a2  s  . c  o m*/

    JFreeChart chart = getChart("summary.chart1", 0);
    Plot plot = chart.getPlot();
    Assert.assertEquals("plot", PiePlot.class, plot.getClass());
    Assert.assertFalse("circular", ((PiePlot) plot).isCircular());
    Assert.assertEquals("label format", "label {0}",
            ((StandardPieSectionLabelGenerator) ((PiePlot) plot).getLabelGenerator()).getLabelFormat());
    Assert.assertEquals("legend label format", "legend label {0}",
            ((StandardPieSectionLabelGenerator) ((PiePlot) plot).getLegendLabelGenerator()).getLabelFormat());

    chart = getChart("summary.chart2", 0);
    plot = chart.getPlot();
    Assert.assertNull("label format", ((PiePlot) plot).getLabelGenerator());
}