Example usage for junit.framework AssertionFailedError AssertionFailedError

List of usage examples for junit.framework AssertionFailedError AssertionFailedError

Introduction

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

Prototype

public AssertionFailedError(String message) 

Source Link

Usage

From source file:de.codesourcery.eve.skills.util.XMLMapperTest.java

private void assertArrayEquals(int[] expected, int[] actual) {

    boolean result;
    if (expected == null || actual == null) {
        result = expected == actual;/*from w ww.  ja v a2s.c  om*/
    } else {
        if (expected.length != actual.length) {
            result = false;
        } else {
            for (int i = 0; i < expected.length; i++) {
                if (!ObjectUtils.equals(expected[i], actual[i])) {
                    throw new AssertionFailedError("expected: " + ObjectUtils.toString(expected) + " , got: "
                            + ObjectUtils.toString(actual));
                }
            }
            return;
        }
    }

    if (!result) {
        throw new AssertionFailedError(
                "expected: " + ObjectUtils.toString(expected) + " , got: " + ObjectUtils.toString(actual));
    }
}

From source file:com.orga.ivy.plugins.p4resolver.BaseTestCase.java

/**
 * Fails the test.//from w w  w  . j  a va  2  s. c o m
 * 
 * @param t Throwable that should be used as the reason for failing.
 */
protected void fail(Throwable t) {
    t.printStackTrace();
    throw new AssertionFailedError(t.getMessage());
}

From source file:ir.keloud.android.lib.test_project.test.SimpleFactoryManagerTest.java

public void testRemoveClientFor() {
    try {/*from  w w  w .  java 2  s . c o  m*/
        KeloudClient client = mSFMgr.getClientFor(mValidAccount, getContext());
        mSFMgr.removeClientFor(mValidAccount);
        assertNotSame("Got same client instance after removing it from manager", client,
                mSFMgr.getClientFor(mValidAccount, getContext()));

    } catch (Exception e) {
        throw new AssertionFailedError("Exception getting client for account: " + e.getMessage());
    }
    // TODO harder tests
}

From source file:ir.keloud.android.lib.test_project.test.SingleSessionManagerTest.java

public void testRemoveClientFor() {
    try {//from w w w  .j a  v  a 2s  . c  o  m
        KeloudClient client1 = mSSMgr.getClientFor(mValidAccount, getContext());
        mSSMgr.removeClientFor(mValidAccount);
        assertNotSame("Got same client instance after removing it from manager", client1,
                mSSMgr.getClientFor(mValidAccount, getContext()));
    } catch (Exception e) {
        throw new AssertionFailedError("Exception getting client for account: " + e.getMessage());
    }

    // TODO harder tests
}

From source file:com.owncloud.android.lib.test_project.test.SimpleFactoryManagerTest.java

public void testRemoveClientFor() {
    try {/* w w w  . java  2  s  .  c  o m*/
        OwnCloudClient client = mSFMgr.getClientFor(mValidAccount, getContext());
        mSFMgr.removeClientFor(mValidAccount);
        assertNotSame("Got same client instance after removing it from manager", client,
                mSFMgr.getClientFor(mValidAccount, getContext()));

    } catch (Exception e) {
        throw new AssertionFailedError("Exception getting client for account: " + e.getMessage());
    }
    // TODO harder tests
}

From source file:com.owncloud.android.lib.test_project.test.SingleSessionManagerTest.java

public void testRemoveClientFor() {
    try {//w  ww  .j a v  a2 s  .com
        OwnCloudClient client1 = mSSMgr.getClientFor(mValidAccount, getContext());
        mSSMgr.removeClientFor(mValidAccount);
        assertNotSame("Got same client instance after removing it from manager", client1,
                mSSMgr.getClientFor(mValidAccount, getContext()));
    } catch (Exception e) {
        throw new AssertionFailedError("Exception getting client for account: " + e.getMessage());
    }

    // TODO harder tests
}

From source file:org.androidannotations.test15.rest.RequestTestBuilder.java

private void checkResponseCookies() throws AssertionFailedError {
    for (String responseCookieName : responseCookies.keySet()) {
        String cookieValue = myService.getCookie(responseCookieName);
        if (cookieValue == null || !cookieValue.equals(responseCookies.get(responseCookieName))) {
            throw new AssertionFailedError("Response cookie " + responseCookieName + " wasn't set");
        }/*from www.j a v a 2s .  c  o m*/
    }
}

From source file:de.codesourcery.eve.apiclient.cache.FilesystemResponseCacheTest.java

protected void assertCacheDirEmpty() {

    final String[] files = tmpDir.list();
    if (files.length > 0) {
        throw new AssertionFailedError("Cache dir should be empty but contains " + ObjectUtils.toString(files));
    }/*from w  w w . j  a  va  2 s .c o  m*/
}

From source file:de.codesourcery.eve.skills.util.XMLMapperTest.java

private void assertArrayEquals(float[] expected, float[] actual) {

    boolean result;
    if (expected == null || actual == null) {
        result = expected == actual;//from www  .  j ava2  s .  co  m
    } else {
        if (expected.length != actual.length) {
            result = false;
        } else {
            for (int i = 0; i < expected.length; i++) {
                if (!ObjectUtils.equals(expected[i], actual[i])) {
                    throw new AssertionFailedError("expected: " + ObjectUtils.toString(expected) + " , got: "
                            + ObjectUtils.toString(actual));
                }
            }
            return;
        }
    }

    if (!result) {
        throw new AssertionFailedError(
                "expected: " + ObjectUtils.toString(expected) + " , got: " + ObjectUtils.toString(actual));
    }
}