List of usage examples for org.springframework.util Assert isTrue
@Deprecated public static void isTrue(boolean expression)
From source file:fr.rktv.iamcore.test.hibernate.AuthHibernateDAOTest.java
/** * Test case checking failure case of licensedUserAlreadyExist method of Authenticate DAO * @throws IllegalArgumentException//from ww w . ja v a2s . c o m * @throws IllegalAccessException */ @Test public void licesUsrAlreadyExistTestFail() throws IllegalArgumentException, IllegalAccessException { final Credentail user = new Credentail("testuser", "test"); user.setLicense(license); authenticationDAO.addUser(user); Assert.isTrue(!authenticationDAO.licensedUserAlreadyExist("23a4a4bd-83a9-4b95-be9a-638bf5fd3534")); }
From source file:org.oncoblocks.centromere.core.test.DataImportTests.java
@Test public void geneInfoReaderTest() throws Exception { GeneInfoReader reader = new GeneInfoReader(); List<EntrezGene> genes = new ArrayList<>(); try {//from w w w.j av a2 s . co m reader.open(geneInfoPath); EntrezGene gene = reader.readRecord(); while (gene != null) { genes.add(gene); gene = reader.readRecord(); } } finally { reader.close(); } Assert.notEmpty(genes); Assert.isTrue(genes.size() == 5); Assert.isTrue(genes.get(4).getEntrezGeneId().equals(10L)); }
From source file:de.iew.raspimotion.controllers.MotionJpegController.java
@RequestMapping(value = "stream/{imagename:.+}") public void streamAction(HttpServletResponse response, @PathVariable String imagename) throws Exception { Assert.isTrue(validateImagename(imagename)); OutputStream out = response.getOutputStream(); try {/*w w w .j a v a 2 s . c o m*/ FileDescriptor file = this.fileDao.getFileLastCreated(imagename); if (file == null) { throw new NoSuchElementException("Image was not found"); } sendCachingHeaders(response); response.setStatus(HttpServletResponse.SC_OK); response.setContentType("multipart/x-mixed-replace;boundary=BOUNDARY"); writeFrameBoundary(out); writeFrame(out, file); long processingTime; long startTs; double fpsTime = 1000 / this.fps; long sleepTime; while (true) { startTs = System.currentTimeMillis(); file = this.fileDao.getFileLastCreated(imagename); writeFrame(out, file); processingTime = System.currentTimeMillis() - startTs; if (log.isDebugEnabled()) { log.debug("Zeitdauer fr gesamten Vorgang: " + processingTime); } sleepTime = (long) (fpsTime - processingTime); if (log.isDebugEnabled()) { log.debug("Schlafe " + sleepTime); } if (sleepTime > 0) { Thread.sleep(sleepTime); } } } catch (Exception e) { if (log.isErrorEnabled()) { log.error("Motion JPEG handling aborted", e); } try { out.flush(); out.close(); } catch (Exception ex) { if (log.isDebugEnabled()) { log.debug("Closing failed", ex); } } } }
From source file:org.oncoblocks.centromere.sql.test.GenericJdbcRepositoryTests.java
@Test public void findAllSorted() { List<Subject> subjects = subjectRepository .findAll(new Sort(new Sort.Order(Sort.Direction.DESC, "subjects.subject_id"))); Assert.notNull(subjects);/*from w ww. ja v a 2s.c om*/ Assert.notEmpty(subjects); Subject subject = subjects.get(0); Assert.notNull(subject); Assert.isTrue(subject.getId().equals(5L)); Assert.isTrue(subject.getName().equals("A375")); }
From source file:com.enonic.cms.core.security.userstore.connector.AbstractBaseUserStoreConnector.java
private String getUniqueUsername(String suggestedUsername) { Assert.isTrue(StringUtils.isNotBlank(suggestedUsername)); suggestedUsername = NameGenerator.transcribeName(suggestedUsername); int i = 0;//from w ww.j ava2s. co m String baseName = suggestedUsername; while (true) { if (isUsernameUnique(suggestedUsername)) { return suggestedUsername; } else { i++; suggestedUsername = baseName + i; } Assert.isTrue(i < 100, "Not able to resolve user name within 100 attempts to create unique"); } }
From source file:com.crossover.trial.weather.endpoint.RestWeatherCollectorEndpoint.java
@RequestMapping(path = "/collect/weather/{iata}/{pointType}", method = POST, consumes = "application/json") @ApiResponses({ @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Bad Request") }) public ResponseEntity<Void> updateWeather(@PathVariable("iata") IATA iata, @PathVariable("pointType") DataPointType pointType, @RequestBody Data data) { Assert.isTrue(iata != null); Assert.isTrue(pointType != null);//from ww w . j av a2 s. c o m Assert.isTrue(data != null); Airport airport = airportRepository.findOne(iata); if (airport == null) return badRequest().build(); DataPoint dataPoint = createDataPoint(data, pointType); if (dataPoint == null) return badRequest().build(); Measurement measurement = updateWeather(airport, dataPoint); return measurement == null ? badRequest().build() : ok().build(); }
From source file:com.enonic.cms.business.core.security.userstore.connector.AbstractBaseUserStoreConnector.java
private String getUniqueUsername(String suggestedUsername) { Assert.isTrue(StringUtils.isNotBlank(suggestedUsername)); suggestedUsername = UserHandler.latinToAZ(suggestedUsername).toLowerCase(); suggestedUsername.replaceAll("\\s+", ""); int i = 0;/*from w ww . j a v a 2 s.c om*/ String baseName = suggestedUsername; while (true) { if (isUsernameUnique(suggestedUsername)) { return suggestedUsername; } else { i++; suggestedUsername = baseName + i; } Assert.isTrue(i < 100, "Not able to resolve user name within 100 attempts to create unique"); } }
From source file:com.mike.angry.dm.Digital.java
public DigitalResolveResultDO filterByKeep(Integer keepValue, DataModel dataModel) { Assert.isTrue(possibleNums.contains(keepValue)); ArrayList<Integer> newPossibleNums = new ArrayList<Integer>(); newPossibleNums.add(keepValue);/* w w w . jav a 2 s.co m*/ return filterByKeep(newPossibleNums, dataModel); }
From source file:com.orange.cepheus.broker.SubscriptionsTest.java
@Test public void addSubscriptionTest() throws URISyntaxException, SubscriptionException, SubscriptionPersistenceException { SubscribeContext subscribeContext = createSubscribeContextTemperature(); String subscriptionId = subscriptions.addSubscription(subscribeContext); Assert.notNull(subscriptionId);//from w w w . j a v a 2 s . c om Assert.hasLength(subscriptionId); Assert.notNull(subscriptions.getSubscription(subscriptionId)); Map<String, Subscription> subscriptions = subscriptionsRepository.getAllSubscriptions(); Assert.isTrue(subscriptions.size() == 1); Assert.notNull(subscriptions.get(subscriptionId).getExpirationDate()); }
From source file:org.esco.portlet.flashinfo.FlashInfoDaoTest.java
@Test public void testGson() throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(resource.getInputStream())); StringBuilder stringBuilder = new StringBuilder(); String line;//from w w w . ja va 2s . c o m while ((line = br.readLine()) != null) { stringBuilder.append(line).append('\n'); } br.close(); List<FlashInfo> fil = flashInfoResourceGson.retrieveInfos(stringBuilder.toString()); //flashInfoResourceGson.retrieveInfos("https://test-lycee.reciaent.fr/static/mockGuestService"); Assert.notNull(fil); Assert.notEmpty(fil); Assert.isTrue(fil.size() == 4); }