From bb0a42733d02fa6f9bd7f5653d54814b4251b9e1 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 1 Mar 2016 15:02:18 +0100 Subject: [PATCH] DATAMONGO-1389 - Fixed test case to verify type predicting bean registration. Related ticket: DATACMNS-821. --- ...goRepositoriesRegistrarIntegrationTests.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoRepositoriesRegistrarIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoRepositoriesRegistrarIntegrationTests.java index 3676619e4..32d49c7b8 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoRepositoriesRegistrarIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/MongoRepositoriesRegistrarIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,11 @@ */ package org.springframework.data.mongodb.repository.config; +import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; +import java.util.Arrays; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -55,9 +58,7 @@ public class MongoRepositoriesRegistrarIntegrationTests { @Autowired ApplicationContext context; @Test - public void testConfiguration() { - - } + public void testConfiguration() {} /** * @see DATAMONGO-901 @@ -65,12 +66,8 @@ public class MongoRepositoriesRegistrarIntegrationTests { @Test public void registersTypePredictingPostProcessor() { - for (String name : context.getBeanDefinitionNames()) { - if (name.startsWith("org.springframework.data.repository.core.support.RepositoryInterfaceAwareBeanPostProcessor")) { - return; - } - } + Iterable beanNames = Arrays.asList(context.getBeanDefinitionNames()); - fail("Expected to find a bean with name starting with RepositoryInterfaceAwareBeanPostProcessor"); + assertThat(beanNames, hasItem(containsString("RepositoryFactoryBeanSupport_Predictor"))); } }