List of usage examples for org.springframework.util Assert isNull
@Deprecated public static void isNull(@Nullable Object object)
From source file:org.venice.piazza.servicecontroller.taskmanaged.TaskManagedTests.java
/** * Tests pulling a Job off the queue for a service that doesn't exist; thus causing an exception. */// w w w . java 2 s . co m @Test(expected = ResourceAccessException.class) public void testGetJobError() throws ResourceAccessException, InterruptedException, InvalidInputException { // Test - No service job found ExecuteServiceJob job = serviceTaskManager.getNextJobFromQueue("service123"); Assert.isNull(job); // Test - No Piazza Job found. Exception should be thrown. Mockito.when(mongoAccessor.getNextJobInServiceQueue("service123")) .thenReturn(new ServiceJob("job123", "service123")); serviceTaskManager.getNextJobFromQueue("service123"); }
From source file:cz.muni.fi.airportservicelayer.services.StewardServiceTest.java
@Test public void testCreate() { Assert.isNull(stewardService.createSteward(null, null)); Assert.notNull(stewardService.createSteward(s1, "pw")); }
From source file:com.qpark.eip.core.spring.security.https.HttpsRequester.java
@PostConstruct public void init() throws Exception { if (this.trustManager == null) { // HTTP AUTH if (this.httpAuthUser != null && this.httpAuthUser.length() > 0) { this.httpAuthBase64 = new String(Base64.encode(new StringBuffer(256).append(this.httpAuthUser) .append(":").append(this.httpAuthPwd == null ? "" : this.httpAuthPwd).toString() .getBytes("UTF-8")), "UTF-8"); }//from w w w .j a v a2 s .co m // Keystore handler trust manager Resource keystore = null; if (this.keystoreSource == null) { Assert.isNull(this.keystoreSource); } else { if (this.keystoreSource.startsWith("classpath:")) { keystore = new ClassPathResource(this.keystoreSource); } else { keystore = new FileSystemResource(this.keystoreSource); } } if (keystore == null) { Assert.isNull(keystore); } this.trustManager = new EipX509TrustManager(); this.trustManager.setKeystore(keystore); this.trustManager.setKeystorePassword(new String(this.keystorePwd)); this.trustManager.init(); } // SSL Context SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(null, new TrustManager[] { this.trustManager }, null); SSLContext.setDefault(ctx); }
From source file:org.appverse.web.framework.backend.persistence.services.integration.impl.test.UserRepositoryImplTest.java
@Override @Test//from w ww.ja v a2 s . c om public void retrieveByFilter() throws Exception { UserDTO userDTORetrieved = userRepository.retrieve(userDTO); Assert.isNull(userDTORetrieved); persist(); IntegrationDataFilter filter = new IntegrationDataFilter(); filter.addStrictCondition("name", "name1"); try { userDTORetrieved = userRepository.retrieve(filter); } catch (PersistenceException e) { if (!(e.getCause() instanceof NoResultException)) { throw e; } } Assert.isNull(userDTORetrieved); filter = new IntegrationDataFilter(); filter.addStrictCondition("name", "name"); userDTORetrieved = userRepository.retrieve(filter); Assert.notNull(userDTORetrieved); }
From source file:cz.muni.fi.airportservicelayer.services.StewardServiceTest.java
@Test public void testFindById() { Steward steward = stewardService.findById(stewardService.createSteward(s1, "pw")); Assert.notNull(steward);/* ww w . java2 s. co m*/ assert steward.getPersonalIdentificator().equals(s1.getPersonalIdentificator()); Assert.isNull(stewardService.findById(null)); }
From source file:cz.muni.fi.airportservicelayer.services.StewardServiceTest.java
@Test public void testFindByPersonalIdentificator() { Steward steward = stewardService.findById(stewardService.createSteward(s1, "pw")); Steward result = stewardService.findByPersonalIdentificator(s1.getPersonalIdentificator()); assertEquals(steward, result);// w w w . j av a2s. com Assert.isNull(stewardService.findByPersonalIdentificator(null)); }
From source file:cz.muni.fi.airport.tests.StewardDaoTest.java
@Test public void testRemove() { Steward s1 = new Steward(); formatter = new SimpleDateFormat("yyyy/MM/dd"); Date birth = null;// w ww.j a v a2 s. co m Date employment = null; try { birth = formatter.parse("1988/02/02"); employment = formatter.parse("2014/03/01"); } catch (ParseException ex) { Logger.getLogger(StewardDaoTest.class.getName()).log(Level.SEVERE, null, ex); } s1.setDateOfBirth(birth); s1.setEmploymentDate(employment); s1.setFirstname("Emma"); s1.setSurname("Stevenson"); s1.setGender(Gender.FEMALE); s1.setUsername("bbb"); s1.setPersonalIdentificator("123-12345"); stewardDao.create(s1); Assert.notNull(stewardDao.findById(s1.getId())); stewardDao.remove(s1); Assert.isNull(stewardDao.findById(s1.getId())); }
From source file:org.appverse.web.framework.backend.persistence.services.integration.impl.test.UserRepositoryImplTest.java
@Override @Test//from ww w.j a va 2 s .c o m public void retrieveByPk() throws Exception { UserDTO userDTORetrieved = userRepository.retrieve(userDTO); Assert.isNull(userDTORetrieved); persist(); userDTORetrieved = userRepository.retrieve(0); Assert.isNull(userDTORetrieved); userDTORetrieved = userRepository.retrieve(userDTO.getId()); Assert.notNull(userDTORetrieved); }
From source file:cz.muni.fi.airportservicelayer.facade.StewardFacadeTest.java
@Test public void testRemoveSteward() { Long id = stewardFacade.createSteward(s1); Assert.notNull(stewardFacade.getStewardWithId(id)); stewardFacade.removeSteward(id);// www.j a va 2 s.c o m StewardDTO tmp = stewardFacade.getStewardWithId(id); Assert.isNull(tmp); }
From source file:com.orange.cepheus.broker.LocalRegistrationsTest.java
@Test public void testUnregisterWithZeroDuration() throws Exception { RegisterContext registerContext = createRegistrationContext(); String registrationId = localRegistrations.updateRegistrationContext(registerContext); // Remove registration using a zero duration RegisterContext zeroDuration = createRegistrationContext(); zeroDuration.setRegistrationId(registrationId); zeroDuration.setDuration("PT0S"); localRegistrations.updateRegistrationContext(zeroDuration); Assert.isNull(localRegistrations.getRegistration(registrationId)); verify(remoteRegistrations).removeRegistration(registrationId); verify(registrationsRepository).removeRegistration(eq(registrationId)); }