Java 类org.hamcrest.collection.IsArrayContaining 实例源码

项目:extended-objects    文件:BootstrapTest.java   
@Test
public void testUnit() {
    XOManagerFactory XOManagerFactory = XO.createXOManagerFactory("testUnit");
    assertThat(XOManagerFactory, not(equalTo(null)));
    XOManagerFactoryImpl xoManagerFactoryImpl = (XOManagerFactoryImpl) XOManagerFactory;
    XOUnit xoUnit = xoManagerFactoryImpl.getXOUnit();
    assertThat(xoUnit.getName(), equalTo("testUnit"));
    assertThat(xoUnit.getDescription(), equalTo("This is a test unit."));
    assertThat(xoUnit.getUri().toString(), equalTo("file://foo"));
    assertThat(xoUnit.getProvider(), typeCompatibleWith(TestXOProvider.class));
    Set<? extends Class<?>> types = xoUnit.getTypes();
    assertThat(types.size(), equalTo(1));
    assertThat(types.toArray(), IsArrayContaining.<Object>hasItemInArray(A.class));
    assertThat(xoUnit.getValidationMode(), equalTo(NONE));
    assertThat(xoUnit.getConcurrencyMode(), equalTo(MULTITHREADED));
    assertThat(xoUnit.getDefaultTransactionAttribute(), equalTo(MANDATORY));
    assertThat(xoUnit.getProperties(), hasEntry(equalTo((Object) "foo"), equalTo((Object) "bar")));
}
项目:Lock-Google.Android    文件:GoogleAuthProviderTest.java   
@Test
public void shouldSetScopes() throws Exception {
    Scope scope1 = new Scope(Scopes.PLUS_LOGIN);
    Scope scope2 = new Scope(Scopes.EMAIL);
    Scope scope3 = new Scope(Scopes.PROFILE);

    provider.setScopes(scope1, scope2, scope3);

    assertThat(provider.getScopes(), is(arrayWithSize(3)));
    assertThat(provider.getScopes(), IsArrayContaining.hasItemInArray(scope1));
    assertThat(provider.getScopes(), IsArrayContaining.hasItemInArray(scope2));
    assertThat(provider.getScopes(), IsArrayContaining.hasItemInArray(scope3));
}
项目:extended-objects    文件:BootstrapTest.java   
@Test
public void traceProvider() {
    XOManagerFactory XOManagerFactory = XO.createXOManagerFactory("traceProvider");
    assertThat(XOManagerFactory, not(equalTo(null)));
    XOManagerFactoryImpl xoManagerFactoryImpl = (XOManagerFactoryImpl) XOManagerFactory;
    XOUnit xoUnit = xoManagerFactoryImpl.getXOUnit();
    assertThat(xoUnit.getName(), equalTo("traceProvider"));
    assertThat(xoUnit.getProvider(), typeCompatibleWith(TraceDatastoreProvider.class));
    Set<? extends Class<?>> types = xoUnit.getTypes();
    assertThat(types.size(), equalTo(1));
    assertThat(types.toArray(), IsArrayContaining.<Object>hasItemInArray(A.class));
    assertThat(xoUnit.getDefaultTransactionAttribute(), equalTo(NONE));
}
项目:smog    文件:ArraysTest.java   
@Test
public void canAssignIsArrayContainingMatcher() {
    Matcher<Phone[]> m = IsArrayContaining.hasItemInArray(aPhoneThat().hasCode("4321"));
    assertThat(bob, is(aPersonThat().hasPhones(m)));
}