Spring Framework AbstractTestNGSpringContextTests - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework AbstractTestNGSpringContextTests class.

This code example shows how to use the following methods:
/** 
 * @author Marius Bogoevici 
 */ 
@Test(groups = "functional", testName = "spring.config.InfinispanContainerCacheManagerDefinitionTest")
@ContextConfiguration 
public class InfinispanContainerCacheManagerDefinitionTest extends AbstractTestNGSpringContextTests {
 
   @Autowired 
   @Qualifier("cacheManager") 
   private CacheManager containerCacheManager;
 
   @Autowired 
   @Qualifier("cacheManager2") 
   private CacheManager containerCacheManager2;
 
   public void testContainerCacheManagerExists() { 
      Assert.assertNotNull(containerCacheManager);
      Assert.assertNotNull(containerCacheManager2);
   } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @author Marius Bogoevici 
 */ 
 
@Test(groups = "functional", testName = "spring.config.InfinispanEmbeddedCacheManagerDefinitionTest")
@ContextConfiguration 
public class InfinispanEmbeddedCacheManagerDefinitionTest extends AbstractTestNGSpringContextTests {
 
   @Autowired 
   @Qualifier("cacheManager") 
   private CacheManager embeddedCacheManager;
 
   @Autowired 
   @Qualifier("withConfigFile") 
   private CacheManager embeddedCacheManagerWithConfigFile;
 
   public void testEmbeddedCacheManagerExists() { 
      Assert.assertNotNull(embeddedCacheManager);
      Assert.assertNotNull(embeddedCacheManagerWithConfigFile);
   } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @author Marius Bogoevici 
 */ 
 
@Test(groups = "functional", testName = "spring.config.InfinispanRemoteCacheManagerDefinitionTest")
@ContextConfiguration 
public class InfinispanRemoteCacheManagerDefinitionTest extends AbstractTestNGSpringContextTests {
 
   @Autowired 
   @Qualifier("cacheManager") 
   private CacheManager remoteCacheManager;
 
   @Autowired 
   @Qualifier("withConfigFile") 
   private CacheManager remoteCacheManagerWithConfigFile;
 
   @Test
   public void testRemoteCacheManagerExists() { 
      Assert.assertNotNull(remoteCacheManager);
      Assert.assertNotNull(remoteCacheManagerWithConfigFile);
   } 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:expect, replay, reset, verify
 
    private Project project = EasyMock.createMock(Project.class);
 
    @Test
    public void testGetTests() throws IOException {
        reset(project);
        expect(project.getProjectHome()).andReturn(new ClassPathResource("test-project").getFile().getAbsolutePath()).atLeastOnce();
        replay(project);
 
        List<TestCaseData> tests = testCaseService.getTests(project);
 
        Assert.assertNotNull(tests);
        Assert.assertEquals(tests.size(), 4L);
 
        TestCaseData test = tests.get(0);
        Assert.assertEquals(test.getName(), "FooTest");
        Assert.assertEquals(test.getPackageName(), "");
 
        test = tests.get(1);
        Assert.assertEquals(test.getName(), "BarTest");

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 */ 
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
@ContextConfiguration("classpath:/org/infinispan/spring/support/remote/InfinispanNamedRemoteCacheFactoryBeanContextTest.xml") 
// @Test(testName = "spring.support.remote.InfinispanNamedRemoteCacheFactoryBeanContextTest", groups 
// = "functional") 
public class InfinispanNamedRemoteCacheFactoryBeanContextTest extends 
                                                              AbstractTestNGSpringContextTests {
 
   private static final String INFINISPAN_NAMED_REMOTE_CACHE_WITHOUT_FURTHER_CONFIGURATION_BEAN_NAME = "infinispanNamedRemoteCacheWithoutFurtherConfiguration";
 
   // @Test 
   public final void shouldCreateARemoteCacheWithDefaultSettingsIfNoFurtherConfigurationGiven() { 
      final Cache<Object, Object> infinispanNamedRemoteCacheWithoutFurtherConfiguration = this.applicationContext
            .getBean(INFINISPAN_NAMED_REMOTE_CACHE_WITHOUT_FURTHER_CONFIGURATION_BEAN_NAME,
                     Cache.class); 
 
      assertNotNull( 
            "Spring application context should contain a named Infinispan cache having bean name = \"" 
                  + INFINISPAN_NAMED_REMOTE_CACHE_WITHOUT_FURTHER_CONFIGURATION_BEAN_NAME
                  + "\". However, it doesn't.", 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:fail, springTestContextPrepareTestInstance
 
   @BeforeClass 
   @Override 
   protected void springTestContextPrepareTestInstance() throws Exception { 
      try { 
         super.springTestContextPrepareTestInstance(); 
         fail("Show have thrown an error indicating issues with the cache loader"); 
      } catch (IllegalStateException e) { 
      } 
   } 
 
   @Test 
   public void testCacheManagerExists() { 
      Assert.assertNull(cm); 
   } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:mock, when
		} 
 
		@Bean 
		public XmlMolgenisUiLoader xmlMolgenisUiLoader() throws IOException 
		{ 
			return when(mock(XmlMolgenisUiLoader.class).load()).thenReturn(molgenis()).getMock(); 
		} 
 
		@Bean 
		public Molgenis molgenis() 
		{ 
			return mock(Molgenis.class); 
		} 
 
		@Bean 
		public MolgenisSettings molgenisSettings() 
		{ 
			return mock(MolgenisSettings.class); 
		} 
 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * 
 */ 
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
@ContextConfiguration("classpath:/org/infinispan/spring/support/InfinispanDefaultCacheFactoryBeanContextTest.xml") 
@Test(testName = "spring.support.InfinispanDefaultCacheFactoryBeanContextTest", groups = "unit")
public class InfinispanDefaultCacheFactoryBeanContextTest extends AbstractTestNGSpringContextTests {
 
   private static final String DEFAULT_CACHE_NAME = "testDefaultCache";
 
   @Test
   public final void shouldProduceANonNullCache() { 
      final Cache<Object, Object> testDefaultCache = this.applicationContext.getBean(
            DEFAULT_CACHE_NAME, Cache.class);
 
      assertNotNull( 
            "Spring application context should contain an Infinispan cache under the bean name \"" 
                  + DEFAULT_CACHE_NAME + "\". However, it doesn't.", testDefaultCache);
   } 
 
   @Test
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:assertEquals, assertNotNull
    @SuppressWarnings("unchecked") 
    public void shouldFindJsonHomeWithAspects() { 
        final MockHttpServletResponse response = new MockHttpServletResponse();
        final Map<String,?> json = jsonHomeController.getAsApplicationJson(response);
        final Map<String, Map<String, ?>> resources = (Map<String, Map<String, ?>>) json.get("resources");
        assertNotNull(resources);
        final Map<String, ?> fooResource = resources.get("http://specs.example.org/rel/foo");
        assertNotNull(fooResource);
        final Map<String, String> hrefVars = (Map<String, String>) fooResource.get("href-vars");
        assertEquals(hrefVars.get("fooId"), "http://specs.example.org/rel/foo#fooId");
        assertEquals(fooResource.get("href-template"), "http://example.org/{fooId}");
    } 
 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:any, eq, when
	@SuppressWarnings("unchecked") 
	@Test(expectedExceptions = ObjectNotFoundException.class) 
	public void getNonExistingObject() throws Exception { 
		final String oid = "abababab-abab-abab-abab-000000000001"; 
		Task task = taskManager.createTaskInstance("Get Object"); 
		when(repository.getObject(any(Class.class),eq(oid), any(Collection.class), any(OperationResult.class))) 
				.thenThrow(new ObjectNotFoundException("Object with oid '" + oid + "' not found.")); 
 
		controller.getObject(ObjectType.class, oid, null, task, task.getResult()); 
	} 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java