List of usage examples for org.springframework.util Assert isTrue
public static void isTrue(boolean expression, Supplier<String> messageSupplier)
From source file:org.surfnet.oaaas.model.TokenResponseCacheImpl.java
private void invariant() { Assert.isTrue(maxSize > 0, "Maxsize must be greater then 0"); Assert.isTrue(expireTime < ((1000 * 60 * 60 * 24) + 1), "Maximal expireTime is one day"); Assert.isTrue(expireTime > 0, "ExpireTimeMilliseconds must be greater then 0"); }
From source file:org.intan.hotelMaestro.springdata.model.RoomType.java
@PersistenceConstructor public RoomType(String name, BigDecimal price, String description) { Assert.hasText(name, "Name must not be null or empty!"); Assert.isTrue(BigDecimal.ZERO.compareTo(price) < 0, "Price must be greater than zero!"); this.name = name; this.price = price; this.description = description; }
From source file:org.xinta.eazycode.components.shiro.web.vo.EditUserVO.java
public void updateUser(User user) { Assert.isTrue(userId.equals(user.getId()), "User ID of command must match the user being updated."); user.setLoginName(getLoginName());/*from w ww. j av a2 s .c o m*/ user.setEmail(getEmail()); if (StringUtils.hasText(getPassword())) { user.setPassword(new Sha256Hash(getPassword()).toHex()); } }
From source file:com.laxser.blitz.lama.core.LamaDaoFactoryBean.java
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(dataAccessProvider);/*from w w w . j ava 2 s.co m*/ Assert.isTrue(daoClass.isInterface(), "not a interface class: " + daoClass.getName()); }
From source file:jails.http.client.support.ProxyFactoryBean.java
public void afterPropertiesSet() throws IllegalArgumentException { Assert.notNull(type, "'type' must not be null"); Assert.hasLength(hostname, "'hostname' must not be empty"); Assert.isTrue(port >= 0 && port <= 65535, "'port' out of range: " + port); SocketAddress socketAddress = new InetSocketAddress(hostname, port); this.proxy = new Proxy(type, socketAddress); }
From source file:com.mike.angry.dm.DataModel.java
public List<Digital> getByXPosition(int x) { List<Digital> result = new ArrayList<Digital>(); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (bigSquare[i][j].getX() == x) { result.add(bigSquare[i][j]); }//from w w w. ja v a 2s . c om } } Assert.isTrue(result.size() == 9, "one square num should be 9! x " + x + "result.size()" + result.size()); return result; }
From source file:org.apache.cxf.fediz.service.idp.service.jpa.ClaimDAOJPATest.java
@Test public void testReadAllClaims() { List<Claim> claims = claimDAO.getClaims(0, 999); Assert.isTrue(5 == claims.size(), "Size doesn't match"); }
From source file:com.crossover.trial.weather.domain.DataPointRepositoryImpl.java
@Override @Transactional(propagation = Propagation.MANDATORY) public Measurement createMeasurement(IATA iata, DataPoint dataPoint) { Assert.isTrue(iata != null, "iata is required"); Assert.isTrue(dataPoint != null, "dataPoint is required"); Airport airport = airportRepository.findOne(iata); if (airport == null) return null; return createMeasurement(airport, dataPoint); }
From source file:org.apache.cxf.fediz.service.idp.STSPortFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { Assert.isTrue(applicationContext != null, "Application context must not be null"); STSAuthenticationProvider authProvider = authenticationProvider; if (authProvider == null) { authProvider = applicationContext.getBean(STSAuthenticationProvider.class); }//from w ww . ja va 2s . com Assert.isTrue(authProvider != null, "STSAuthenticationProvider must be configured"); //Only update the port if HTTPS is used, otherwise ignored (like retrieving the WADL over HTTP) if (!isPortSet && request.isSecure()) { try { URL url = new URL(authProvider.getWsdlLocation()); if (url.getPort() == 0) { URL updatedUrl = new URL(url.getProtocol(), url.getHost(), request.getLocalPort(), url.getFile()); setSTSWsdlUrl(authProvider, updatedUrl.toString()); LOG.info("STSAuthenticationProvider.wsdlLocation set to " + updatedUrl.toString()); } else { setSTSWsdlUrl(authProvider, url.toString()); } } catch (MalformedURLException e) { LOG.error("Invalid Url '" + authProvider.getWsdlLocation() + "': " + e.getMessage()); } } chain.doFilter(request, response); }
From source file:com.miko.demo.mongo.model.EntityC.java
@PersistenceConstructor public EntityC(String name, BigDecimal value) { Assert.hasText(name, "Name can not be empty"); Assert.isTrue(BigDecimal.ZERO.compareTo(value) < 0, "Value must be greater than zero!"); this.name = name; this.value = value; }