@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); }
@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); }
@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")))); }
@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)))); }
@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)))); }
@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)))); }
@Test public void clientAuthenticationErrorPage() { assertNotNull(errorController.clientAuthenticationErrorPage(request)); verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("mainMessageCode", is(HodErrorController.MESSAGE_CODE_CLIENT_AUTHENTICATION_ERROR_MAIN)))); }
@Test public void authenticationErrorPage() { assertNotNull(errorController.authenticationErrorPage(request, response)); verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("mainMessageCode", is(CustomErrorController.MESSAGE_CODE_AUTHENTICATION_ERROR_MAIN)))); }
@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)))); }
@Test public void notFoundError() { assertNotNull(errorController.notFoundError(request, response)); verify(controllerUtils).buildErrorModelAndView(argThat(new HasPropertyWithValue<>("mainMessageCode", is(CustomErrorController.MESSAGE_CODE_NOT_FOUND_MAIN)))); }
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; }