Example usage for junit.framework Assert fail

List of usage examples for junit.framework Assert fail

Introduction

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

Prototype

static public void fail(String message) 

Source Link

Document

Fails a test with the given message.

Usage

From source file:com.googlecode.fightinglayoutbugs.helpers.TestHelper.java

public static void fail(String message) {
    Assert.fail(message);
}

From source file:org.duracloud.id.generator.ldap.impl.LdapImplTest.java

@Test
public void testNotInitialize() throws Exception {
    replayMocks();/*from  w w w.j  ava 2  s  .c  om*/

    boolean thrown = false;
    try {
        ldap.maxUserId();
        Assert.fail("exception expected");
    } catch (NotInitializedException e) {
        thrown = true;
    }
    Assert.assertTrue(thrown);
}

From source file:com.impetus.kundera.metadata.mappedsuperclass.InvalidSuperClassTest.java

@Test
public void setup() {
    try {//from  w  w w  . j  a v a  2 s.  c  o m
        EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit);
        Assert.fail("Should have gone to catch block!");
    } catch (MetamodelLoaderException mlex) {
        Assert.assertTrue(StringUtils.startsWith(mlex.getMessage(),
                "Class:class com.impetus.kundera.metadata.mappedsuperclass.InvalidPersonEntityis annotated with @MappedSuperClass and @Entity not allowed"));
    }
}

From source file:azkaban.crypto.DecryptionTest.java

@Test
public void testV1_1() throws IOException {
    BasicConfigurator.configure();//  w ww . j  a  v a  2s  .c  o  m
    Logger.getRootLogger().setLevel(Level.DEBUG);

    String expected = "test";

    String ciphered = "eyJ2ZXIiOiIxLjEiLCJ2YWwiOiJpaE9CM2VzTzBad2F4cHZBV2Z5YUVicHZLQzJBWDJZZnVzS3hVWFN2R3A0PSJ9";
    String passphrase = "test1234";

    Crypto crypto = new Crypto();
    String actual = crypto.decrypt(ciphered, passphrase);
    Assert.assertEquals(expected, actual);

    try {
        new CryptoV1().decrypt(ciphered, passphrase);
        Assert.fail("Should have failed when decrypt v1.1 ciphered text with v1 decryption.");
    } catch (Exception e) {
        Assert.assertTrue(e instanceof RuntimeException);
    }
}

From source file:com.ignou.aadhar.util.EmailSenderTest.java

@Test
public void testSend() {

    try {//from   w w w.ja v a  2s  .  c  o m
        mailSender.send("justdpk@gmail.com", "Testing123", "<h1>Testing onlyHello Spring Email Sender</h1>");
    } catch (Exception e) {
        Assert.fail("Mail was not sent.");
    }
}

From source file:com.fabrefrederic.integrationTest.ITCommitService.java

@Test
@Transactional//from w w  w .  ja  va 2  s  .  c om
public void get_Commits_From_Start_To_End_Revision() {
    // given
    final int numberOfCommits = 5;
    final int startRevision = 1;
    final int endRevision = 5;
    final String repositoryPath = "/trunk/";

    // when
    List<Commit> commits = new ArrayList<Commit>();
    try {
        commits = commitService.getCommits(repositoryPath, startRevision, endRevision);
    } catch (final Exception exception) {
        LOGGER.error("Error during getting commits from the svn repository", exception);
        Assert.fail("Error during getting commits from the svn repository");
    }
    try {
        commitService.saveCommits(commits);
    } catch (final Exception exception) {
        LOGGER.error("Error during saving commits into the database", exception);
        Assert.fail("Error during saving commits into the database");
    }

    // then
    Assert.assertEquals(commits.size(), numberOfCommits);
}

From source file:com.ibm.team.build.internal.hjplugin.tests.RTCFacadeFactoryIT.java

public void testGetFacade() {
    if (Config.DEFAULT.isConfigured()) {
        try {/*from w w w .  j  a v  a  2 s. co m*/
            RTCFacadeFactory.getFacade(Config.DEFAULT.getToolkit(), null);
        } catch (Exception e) {
            Assert.fail("Toolkit not found at " + Config.DEFAULT.getToolkit());
        }
    }
}

From source file:com.googlecode.ehcache.annotations.integration.ConfigurationFailureTest.java

/**
 * Test verifies behavior when no {@link CacheManager} is defined in the Spring configuration.
 */// ww  w  .  ja v  a2s .com
@Test
public void testNoCacheManager() {
    try {
        new ClassPathXmlApplicationContext("/noCacheManagerTestContext.xml");
        Assert.fail("Test should have failed with no CacheManager defined");
    } catch (BeanCreationException bce) {
    }
}

From source file:azkaban.crypto.EncryptionTest.java

@Test
public void testInvalidParams() {
    ICrypto crypto = new Crypto();
    String[] args = { "", null, "test" };
    for (Version ver : Version.values()) {
        for (String plaintext : args) {
            for (String passphrase : args) {
                try {
                    if (!StringUtils.isEmpty(plaintext) && !StringUtils.isEmpty(passphrase)) {
                        String cipheredText = crypto.encrypt(plaintext, passphrase, ver);
                        Assert.assertEquals(plaintext, crypto.decrypt(cipheredText, passphrase));
                    } else {
                        crypto.encrypt(plaintext, passphrase, ver);
                        Assert.fail("Encyption should have failed with invalid parameters. plaintext: "
                                + plaintext + " , passphrase: " + passphrase);
                    }/* ww  w . j a  v a  2s . c o m*/
                } catch (Exception e) {
                    Assert.assertTrue(e instanceof IllegalArgumentException);
                }

            }
        }
    }
}

From source file:org.slc.sli.dashboard.unit.controller.SearchControllerTest.java

@Test
public void testHandle() throws Exception {
    // test good search
    try {//  ww  w.j av  a2  s.c  om
        Assert.assertNotNull(searchController.handle(new StudentSearch("M", "S", ""), request));
    } catch (Exception e) {
        Assert.fail("Should pass but getting " + e.getMessage());
    }
}