org.hamcrest.collection.IsArrayContaining Java Examples

The following examples show how to use org.hamcrest.collection.IsArrayContaining. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BootstrapTest.java    From extended-objects with Apache License 2.0 6 votes vote down vote up
@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")));
}
 
Example #2
Source File: BootstrapTest.java    From extended-objects with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example #3
Source File: AccessTokenTest.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private void validateTokenECDSASignature(String expectedAlg) {
    assertThat(ECDSASignatureProvider.ECDSA.values(), IsArrayContaining.hasItemInArray(ECDSASignatureProvider.ECDSA.valueOf(expectedAlg)));

    try {
        TokenSignatureUtil.changeRealmTokenSignatureProvider(adminClient, expectedAlg);
        TokenSignatureUtil.changeClientAccessTokenSignatureProvider(ApiUtil.findClientByClientId(adminClient.realm("test"), "test-app"), expectedAlg);
        validateTokenSignatureLength(ECDSASignatureProvider.ECDSA.valueOf(expectedAlg).getSignatureLength());
    } finally {
        TokenSignatureUtil.changeRealmTokenSignatureProvider(adminClient, Algorithm.RS256);
        TokenSignatureUtil.changeClientAccessTokenSignatureProvider(ApiUtil.findClientByClientId(adminClient.realm("test"), "test-app"), Algorithm.RS256);
    }
}