Java 类org.hamcrest.beans.HasPropertyWithValue 实例源码

项目:haven-search-components    文件:HodDocumentServiceTest.java   
@Test
public void queryTextIndexRaw() throws HodErrorException {
    final QueryResults<HodSearchResult> mockedResults = mockResults();
    when(queryTextIndexService.queryTextIndexWithText(anyString(), argThat(new HasPropertyWithValue<>("queryProfile", nullValue())))).thenReturn(mockedResults);

    when(queryRequest.getQueryType()).thenReturn(QueryRequest.QueryType.RAW);
    final Documents<HodSearchResult> results = documentsService.queryTextIndex(queryRequest);
    validateResults(results);
}
项目:haven-search-components    文件:HodDocumentServiceTest.java   
@Test
public void queryTextIndexForPromotions() throws HodErrorException {
    final QueryResults<HodSearchResult> mockedResults = mockResults();
    when(queryTextIndexService.queryTextIndexWithText(anyString(), argThat(new HasPropertyWithValue<>("promotions", is(true))))).thenReturn(mockedResults);

    when(queryRequest.getQueryType()).thenReturn(QueryRequest.QueryType.PROMOTIONS);
    final Documents<HodSearchResult> results = documentsService.queryTextIndex(queryRequest);
    validateResults(results);
}
项目:l10n-maven-plugin    文件:DirectoryValidatorTest.java   
@Test
public void testMultipleBundlePropertiesFamilyLoading() throws MojoExecutionException {
  File directory = getFile("multi-bundle");
  int nbErrors = validator.loadPropertiesFamily(directory, items, propertiesFamilies);

  assertEquals(0, nbErrors);
  assertEquals(3, propertiesFamilies.size());
  assertThat(propertiesFamilies, hasItem(HasPropertyWithValue.<PropertiesFamily> hasProperty("baseName", is("1"))));
  assertThat(propertiesFamilies, hasItem(HasPropertyWithValue.<PropertiesFamily> hasProperty("baseName", is("2"))));
  assertThat(propertiesFamilies, hasItem(HasPropertyWithValue.<PropertiesFamily> hasProperty("baseName", is("3"))));
}
项目:find    文件:AbstractErrorControllerTest.java   
@Test
public void serverErrorPageWithUUID() {
    request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, mock(Exception.class));

    assertNotNull(errorController.serverErrorPage(request, response));
    verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("mainMessageCode", is(CustomErrorController.MESSAGE_CODE_INTERNAL_SERVER_ERROR_MAIN))));
    verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("subMessageCode", is(CustomErrorController.MESSAGE_CODE_INTERNAL_SERVER_ERROR_SUB))));
}
项目:ehcache3    文件:VoltronReadWriteLockActiveEntityTest.java   
@Test
public void testWriteUnlockNotifiesListeners() throws MessageCodecException {
  ClientCommunicator communicator = mock(ClientCommunicator.class);
  VoltronReadWriteLockActiveEntity entity = new VoltronReadWriteLockActiveEntity(communicator);

  ClientDescriptor locker = mock(ClientDescriptor.class);
  ClientDescriptor waiter = mock(ClientDescriptor.class);

  entity.invoke(locker, LockMessaging.lock(WRITE));
  entity.invoke(waiter, LockMessaging.lock(WRITE));
  entity.invoke(locker, LockMessaging.unlock(WRITE));

  verify(communicator).sendNoResponse(eq(waiter), argThat(
          HasPropertyWithValue.<EntityResponse>hasProperty("released", is(true))));
}
项目:ehcache3    文件:VoltronReadWriteLockActiveEntityTest.java   
@Test
public void testReadUnlockNotifiesListeners() throws MessageCodecException {
  ClientCommunicator communicator = mock(ClientCommunicator.class);
  VoltronReadWriteLockActiveEntity entity = new VoltronReadWriteLockActiveEntity(communicator);

  ClientDescriptor locker = mock(ClientDescriptor.class);
  ClientDescriptor waiter = mock(ClientDescriptor.class);

  entity.invoke(locker, LockMessaging.lock(READ));
  entity.invoke(waiter, LockMessaging.lock(WRITE));
  entity.invoke(locker, LockMessaging.unlock(READ));

  verify(communicator).sendNoResponse(eq(waiter), argThat(
          HasPropertyWithValue.<EntityResponse>hasProperty("released", is(true))));
}
项目:find    文件:HodErrorControllerTest.java   
@Test
public void clientAuthenticationErrorPage() {
    assertNotNull(errorController.clientAuthenticationErrorPage(request));
    verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("mainMessageCode", is(HodErrorController.MESSAGE_CODE_CLIENT_AUTHENTICATION_ERROR_MAIN))));
}
项目:find    文件:AbstractErrorControllerTest.java   
@Test
public void authenticationErrorPage() {
    assertNotNull(errorController.authenticationErrorPage(request, response));
    verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("mainMessageCode", is(CustomErrorController.MESSAGE_CODE_AUTHENTICATION_ERROR_MAIN))));
}
项目:find    文件:AbstractErrorControllerTest.java   
@Test
public void serverErrorPageWithoutUUID() {
    assertNotNull(errorController.serverErrorPage(request, response));
    verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("mainMessageCode", is(CustomErrorController.MESSAGE_CODE_INTERNAL_SERVER_ERROR_MAIN))));
    verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("subMessageCode", is(CustomErrorController.MESSAGE_CODE_INTERNAL_SERVER_ERROR_SUB))));
}
项目:find    文件:AbstractErrorControllerTest.java   
@Test
public void notFoundError() {
    assertNotNull(errorController.notFoundError(request, response));
    verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("mainMessageCode", is(CustomErrorController.MESSAGE_CODE_NOT_FOUND_MAIN))));
}
项目:redsniff    文件:IsTableColumn.java   
public IsTableColumn(ColumnIdentifierType identifierType,Matcher<?> identifierMatcher, String identifierDescription) {
    this.identifierMatcher = identifierMatcher;
    this.identifierType = identifierType;
    this.columnMatcher = new HasPropertyWithValue<TableColumn>(identifierType.propertyName, identifierMatcher);
    this.identifierDescription = identifierDescription;
}