Search in sources :

Example 86 with Failure

use of org.junit.runner.notification.Failure in project ddf by codice.

the class BinaryContentImplTest method testBinaryContentImplNegativeSize.

@Test
public void testBinaryContentImplNegativeSize() {
    InputStream is;
    try {
        is = new FileInputStream(content);
        BinaryContentImpl bci = new BinaryContentImpl(is, mimeType);
        bci.setSize(-20L);
        assertEquals(-1, bci.getSize());
    } catch (IOException e) {
        LOGGER.error("IO Failure", e);
        new Failure(null, e);
    }
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) BinaryContentImpl(ddf.catalog.data.impl.BinaryContentImpl) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) Failure(org.junit.runner.notification.Failure) Test(org.junit.Test)

Example 87 with Failure

use of org.junit.runner.notification.Failure in project ddf by codice.

the class BinaryContentImplTest method testBinaryContentImplByteArrayNotNull.

@Test
public void testBinaryContentImplByteArrayNotNull() {
    InputStream is;
    try {
        is = new FileInputStream(content);
        BinaryContentImpl bci = new BinaryContentImpl(is, mimeType);
        byte[] contents = bci.getByteArray();
        assertNotNull(contents);
    } catch (IOException e) {
        LOGGER.error("IO Failure", e);
        new Failure(null, e);
    }
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) BinaryContentImpl(ddf.catalog.data.impl.BinaryContentImpl) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) Failure(org.junit.runner.notification.Failure) Test(org.junit.Test)

Example 88 with Failure

use of org.junit.runner.notification.Failure in project ddf by codice.

the class ResourceImplTest method testResourceImplNegativeSize.

@Test
public void testResourceImplNegativeSize() {
    InputStream is;
    try {
        is = new FileInputStream(content);
        ResourceImpl ri = new ResourceImpl(is, mimeType, TEST_NAME);
        ri.setSize(-20L);
        assertEquals(-1, ri.getSize());
    } catch (IOException e) {
        LOGGER.error("IO Failure", e);
        new Failure(null, e);
    }
}
Also used : ResourceImpl(ddf.catalog.resource.impl.ResourceImpl) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) Failure(org.junit.runner.notification.Failure) Test(org.junit.Test)

Example 89 with Failure

use of org.junit.runner.notification.Failure in project ddf by codice.

the class ResourceImplTest method setUp.

@Before
public void setUp() {
    content = new File("src/test/resources/data/i4ce.png");
    MimetypesFileTypeMap mimeMapper = new MimetypesFileTypeMap();
    try {
        mimeType = new MimeType(mimeMapper.getContentType(content));
    } catch (MimeTypeParseException e) {
        LOGGER.error("Mime parser Failure", e);
        new Failure(null, e);
    }
}
Also used : MimetypesFileTypeMap(javax.activation.MimetypesFileTypeMap) MimeTypeParseException(javax.activation.MimeTypeParseException) File(java.io.File) MimeType(javax.activation.MimeType) Failure(org.junit.runner.notification.Failure) Before(org.junit.Before)

Example 90 with Failure

use of org.junit.runner.notification.Failure in project bitsquare by bitsquare.

the class StressTestMailboxMessage method main.

// # MAIN ENTRY POINT
// Inspired by <https://stackoverflow.com/a/9288513> by Marc Peters.
public static void main(String[] args) {
    Request request = (args.length == 0) ? Request.aClass(NetworkStressTest.class) : Request.method(NetworkStressTest.class, args[0]);
    Result result = new JUnitCore().run(request);
    for (Failure f : result.getFailures()) System.err.printf("\n%s\n%s", f, f.getTrace());
    System.exit(result.wasSuccessful() ? 0 : 1);
}
Also used : JUnitCore(org.junit.runner.JUnitCore) Request(org.junit.runner.Request) Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result)

Aggregations

Failure (org.junit.runner.notification.Failure)194 Test (org.junit.Test)101 Result (org.junit.runner.Result)91 Description (org.junit.runner.Description)40 IOException (java.io.IOException)32 UnitTest (org.apache.geode.test.junit.categories.UnitTest)27 JUnitCore (org.junit.runner.JUnitCore)24 FileInputStream (java.io.FileInputStream)20 InputStream (java.io.InputStream)20 RunListener (org.junit.runner.notification.RunListener)19 ArrayList (java.util.ArrayList)11 ByteArrayInputStream (java.io.ByteArrayInputStream)9 ComparisonFailure (org.junit.ComparisonFailure)9 JUnit4TestListener (com.intellij.junit4.JUnit4TestListener)7 RunNotifier (org.junit.runner.notification.RunNotifier)7 ResourceImpl (ddf.catalog.resource.impl.ResourceImpl)6 Request (org.junit.runner.Request)6 BinaryContentImpl (ddf.catalog.data.impl.BinaryContentImpl)5 Before (org.junit.Before)5 Runner (org.junit.runner.Runner)5