aboutsummaryrefslogtreecommitdiffstats
path: root/testutil/src/test/java/com/yahoo/test/MatchersTestCase.java
blob: 839856db7f2aed8a6594303b5fc9fbd4eeae8820 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.test;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;

import org.hamcrest.Matcher;
import org.junit.Test;

/**
 * Tests for com.yahoo.test.Matchers.
 *
 * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
 */
public class MatchersTestCase {

    @Test
    public final void testHasItemWithMethodObjectString() {
        @SuppressWarnings("rawtypes")
        final Matcher<Iterable> m = Matchers.hasItemWithMethod("nalle",
                "toLowerCase");
        assertEquals(
                false,
                m.matches(Arrays.asList(new Object[] { Integer.valueOf(1),
                        Character.valueOf('c'), "blbl" })));
        assertEquals(
                true,
                m.matches(Arrays.asList(new Object[] { Character.valueOf('c'),
                        "NALLE" })));
    }

}