Java Arrays.assertTrue Examples

Java Arrays.assertTrue - 30 examples found. These are the top rated real world Java examples of java.util.Arrays.assertTrue extracted from open source projects. You can rate examples to help us improve the quality of examples.
  @Test
  public final void testTotalBoxedLongBoxedLongBoxedLong() {
    final Long[] numbers1 = convertToBoxed(NUMBERS1);
    final Long[] numbers2 = convertToBoxed(NUMBERS2);

    for (final Long n1 : numbers1) {
      for (final Long n2 : numbers2) {
        for (final Long n3 : numbers1) {
          @SuppressWarnings("boxing")
          final long expected = n1 + n2 + n3;
          final long actual = total(n1, n2, n3);
          // System.out.println("expected: " + expected + "\nactual:   " + actual);
          assertTrue(expected == actual);
        }
      }
    }

    final Long[] numbers3 = convertToBoxed(NUMBERS3);
    final Long[] numbers4 = convertToBoxed(NUMBERS4);

    for (final Long n1 : numbers3) {
      for (final Long n2 : numbers4) {
        for (final Long n3 : numbers3) {
          @SuppressWarnings("boxing")
          final long expected = n1 + n2 + n3;
          final long actual = total(n1, n2, n3);
          // System.out.println("expected: " + expected + "\nactual:   " + actual);
          assertTrue(expected == actual);
        }
      }
    }
  }
  @Test
  public final void testSumLongLong() {
    final long[] numbers1 = NUMBERS1;
    final long[] numbers2 = NUMBERS2;

    for (final long n1 : numbers1) {
      for (final long n2 : numbers2) {
        final long expected = n1 + n2;
        final long actual = sum(n1, n2);
        // System.out.println("expected: " + expected + "\nactual:   " + actual);
        assertTrue(expected == actual);
      }
    }

    final long[] numbers3 = NUMBERS3;
    final long[] numbers4 = NUMBERS4;

    for (final long n1 : numbers3) {
      for (final long n2 : numbers4) {
        final long expected = n1 + n2;
        final long actual = sum(n1, n2);
        // System.out.println("expected: " + expected + "\nactual:   " + actual);
        assertTrue(expected == actual);
      }
    }
  }
 @Test
 public void removeConnection() throws Exception {
   ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
   ConnectionFactory<TestApi2> connectionFactory =
       new StubOAuth2ConnectionFactory("clientId", "clientSecret", THROW_EXCEPTION);
   connectionFactoryLocator.addConnectionFactory(connectionFactory);
   StubConnectionRepository connectionRepository = new StubConnectionRepository();
   connectionRepository.addConnection(
       connectionFactory.createConnection(
           new ConnectionData(
               "oauth2Provider", "provider1User1", null, null, null, null, null, null, null)));
   connectionRepository.addConnection(
       connectionFactory.createConnection(
           new ConnectionData(
               "oauth2Provider", "provider1User2", null, null, null, null, null, null, null)));
   assertEquals(2, connectionRepository.findConnections("oauth2Provider").size());
   ConnectController connectController =
       new ConnectController(connectionFactoryLocator, connectionRepository);
   List<DisconnectInterceptor<?>> interceptors = getDisconnectInterceptor();
   connectController.setDisconnectInterceptors(interceptors);
   MockMvc mockMvc = standaloneSetup(connectController).build();
   mockMvc
       .perform(delete("/connect/oauth2Provider/provider1User1"))
       .andExpect(redirectedUrl("/connect/oauth2Provider"));
   assertEquals(1, connectionRepository.findConnections("oauth2Provider").size());
   assertFalse(((TestConnectInterceptor<?>) (interceptors.get(0))).preDisconnectInvoked);
   assertFalse(((TestConnectInterceptor<?>) (interceptors.get(0))).postDisconnectInvoked);
   assertNull(((TestConnectInterceptor<?>) (interceptors.get(0))).connectionFactory);
   assertTrue(((TestConnectInterceptor<?>) (interceptors.get(1))).preDisconnectInvoked);
   assertTrue(((TestConnectInterceptor<?>) (interceptors.get(1))).postDisconnectInvoked);
   assertSame(
       connectionFactory, ((TestConnectInterceptor<?>) (interceptors.get(1))).connectionFactory);
 }
  @Test
  public void supportsPosixlyCorrectBehavior() {
    OptionParser parser = new OptionParser("i:j::k");
    String[] arguments = {
      "-ibar", "-i", "junk", "xyz", "-jixnay", "foo", "-k", "blah", "--", "bah"
    };

    OptionSet options = parser.parse(arguments);

    assertTrue(options.has("i"));
    assertTrue(options.has("j"));
    assertTrue(options.has("k"));
    assertEquals(asList("bar", "junk"), options.valuesOf("i"));
    assertEquals(singletonList("ixnay"), options.valuesOf("j"));
    assertEquals(asList("xyz", "foo", "blah", "bah"), options.nonOptionArguments());

    parser.posixlyCorrect(true);
    options = parser.parse(arguments);

    assertTrue(options.has("i"));
    assertFalse(options.has("j"));
    assertFalse(options.has("k"));
    assertEquals(asList("bar", "junk"), options.valuesOf("i"));
    assertEquals(emptyList(), options.valuesOf("j"));
    assertEquals(
        asList("xyz", "-jixnay", "foo", "-k", "blah", "--", "bah"), options.nonOptionArguments());
  }
 @Test
 public void one() {
   final List<String> values = asList("a", "b", "a", "c", "a", "d", "e");
   assertTrue(Algorithms.one(values, Conditions.eq("c")));
   assertTrue(Algorithms.one(values, Conditions.eq("a")));
   assertTrue(Algorithms.one(values, Conditions.eq("e")));
   assertFalse(Algorithms.one(values, Conditions.eq("f")));
 }
 @Test
 public void isAnnotatedOnClassWithMetaDepth2() {
   assertTrue(isAnnotated(ComposedTransactionalComponentClass.class, TX_NAME));
   assertTrue(isAnnotated(ComposedTransactionalComponentClass.class, Component.class.getName()));
   assertTrue(
       isAnnotated(
           ComposedTransactionalComponentClass.class,
           ComposedTransactionalComponent.class.getName()));
 }