APISonar


org.junit.Assert.fail

> org > junit > Assert > fail
org APIs junit APIs Assert APIs fail APIs

Example 1
protected void fail(String message) {
    checkThread();
    try {
      Assert.fail(message);
    } catch (AssertionError e) {
      handleThrowable(e);
    }
  }
Example 2
protected void fail(String msg) {
		try {
			Assert.fail(msg);
		} catch (AssertionError e) {
			registerError(e);
			throw e;
		}
	}
Example 3
private static void fail(String msg) throws Exception {
        dumpOnFailure();
        Assert.fail(msg);
    }
Example 4
private Action fail( final String message )
    {
        return new Action( "fail( \"" + message + "\" );")
        {
            @Override
            public Void apply( Transaction transaction )
            {
                Assert.fail( message );
                return null;
            }
        };
    }
Example 5
private void fail(Response r, String failureMessage) {
        System.out.println(r.getStatus());
        Assert.fail(failureMessage);
    }
Example 6
void assertListeners(String msg) {
        if (listenerCount == 0) {
            Assert.fail(msg);
        }
    }
Example 7
public void onError(Throwable t) {
        try {
            t.printStackTrace();
            Assert.fail();
        } finally {
            latch.setException(new IOException(t));
        }
    }
Example 8
protected void assertFail(String sMessage)
	{
		if (fUseCollector)
		{
			collector.addError(new Exception(sMessage));
		}
		else
		{
			Assert.fail(sMessage);
		}
	}
Example 9
public String download() {

        try {
            HttpURLConnection conn = getConnection();
            return readConnection(conn);

        } catch (Exception e) {
            Assert.fail(e.getMessage());
        }
        return null;
    }
Example 10
protected void sleep(Long time) {
        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            Assert.fail();
        }
    }
Example 11
private static void assertRfParseFailure(String s)
    {
        try
        {
            ReplicationFactor.fromString(s);
            Assert.fail("Expected IllegalArgumentException");
        }
        catch (IllegalArgumentException e)
        {
            // expected
        }
    }
Example 12
private static void assertThrows(Runnable f) {
    try {
      f.run();
      Assert.fail("Expected to throw.");
    } catch (Exception e) {
      // Expected.
    }
  }
Example 13
public void nullQualifierShouldThrowException() {
        // Given
        final String nullQualifier = null;
        // When
        cache.get(nullQualifier);
        // Then
        Assert.fail();
    }
Example 14
public void threadFail(String reason) {
        try {
            Assert.fail(reason);
        } catch (AssertionFailedError t) {
            threadRecordFailure(t);
            Assert.fail(reason);
        }
    }
Example 15
public void getNonExistentObject() throws Exception {
    final String objectKey = "bucket/non-existent-object";
    try {
      getObjectRestCall(objectKey);
    } catch (AssertionError e) {
      // expected
      return;
    }
    Assert.fail("get non-existent object should fail");
  }
Example 16
public void serializeNotSerializable()
    {
        try
        {
            Object nonSerializable = new Object();
            SerializeTestHelper.serialize(nonSerializable);
        }
        catch (AssertionError ignored)
        {
            return;
        }

        Assert.fail();
    }
Example 17
public static void checkTrue(boolean condition, Object... message)
   {
      if (!condition)
      {
         Assert.fail(objectsToString(message));
      }
   }
Example 18
private <T> void verifyNullable(T nullable1, T nullable2) {
        if (nullable1 == null && nullable2 != null) {
            Assert.fail();
        }
        if (nullable1 != null && nullable2 == null) {
            Assert.fail();
        }
    }
Example 19
private Exception getException(Enumeration elements) {
        try {
            elements.nextElement();
        } catch (Exception e) {
            return e;
        }
        Assert.fail("NoSuchElementException");
        return null;
    }
Example 20
private void checkIfStreamIsClosed(InputStream is) throws IOException {
        try {
            is.read();
            Assert.fail();
        } catch (IOException e) {
        }
    }
Example 21
public static void assertFail(Runnable runnable) {
        try {
            runnable.run();
            Assert.fail();
        } catch (Exception ignored) {
        }
    }
Example 22
public static void foo() {
    String result = null;
    try {
      result = createString();
    }
    catch (Exception e) {
      Assert.fail();
    }
    finally {
      if (result == null) {
        System.out.println("Analysis failed!");
      }
    }
  }
Example 23
static<E> void assertThrowingIterator(Iterator<E> iterator) {
        try {
            iterator.forEachRemaining((entry) -> {});
            Assert.fail();
        } catch (UnsupportedOperationException expected) {
        }
    }
Example 24
private static void executeShouldFail(Executor executor) {
        try {
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    // Noop.
                }
            });
            Assert.fail();
        } catch (RejectedExecutionException expected) {
            // expected
        }
    }
Example 25
public void nullArray() {
        String[] nullArray = null;
        try {
            for (String str : nullArray) {
                logger.warn("null");
            }
            Assert.fail();
        } catch (Exception e) {
        }
    }