List of usage examples for org.springframework.util Assert isTrue
@Deprecated public static void isTrue(boolean expression)
From source file:org.oncoblocks.centromere.web.test.util.ConverterTests.java
@Test public void sourcedAliasConverterTest() { StringToSourcedAliasConverter converter = new StringToSourcedAliasConverter(); SourcedAlias alias = converter.convert("source:alias"); Assert.isTrue(alias.getSource().equals("source")); Assert.isTrue(alias.getName().equals("alias")); alias = converter.convert("source"); Assert.isTrue(alias.getSource().equals("source")); Assert.isNull(alias.getName());/* w w w.j a va 2 s. c o m*/ }
From source file:fr.rktv.iamcore.test.hibernate.AuthHibernateDAOTest.java
/** * Test case for checkUserAuthentication method of Authenticate DAO * @throws IllegalArgumentException// www . j ava 2 s . c o m * @throws IllegalAccessException */ @Test public void checkUserAuthTest() throws IllegalArgumentException, IllegalAccessException { final Credentail newUser = new Credentail("testuser11", "test12"); Assert.isTrue(!authenticationDAO.checkUserAuthentication(newUser)); }
From source file:com.laxser.blitz.web.instruction.TextInstruction.java
@Override public void doRender(Invocation inv) throws Exception { if (StringUtils.isEmpty(text)) { return;//from w ww.j av a 2 s. c o m } if (logger.isDebugEnabled()) { logger.debug("trying to render text:" + text); } HttpServletResponse response = inv.getResponse(); String oldEncoding = response.getCharacterEncoding(); if (StringUtils.isBlank(oldEncoding) || oldEncoding.startsWith("ISO-")) { String encoding = inv.getRequest().getCharacterEncoding(); Assert.isTrue(encoding != null); response.setCharacterEncoding(encoding); if (logger.isDebugEnabled()) { logger.debug("set response.characterEncoding by default:" + response.getCharacterEncoding()); } } if (response.getContentType() == null) { response.setContentType("text/html"); if (logger.isDebugEnabled()) { logger.debug("set response content-type by default: " + response.getContentType()); } } sendResponse(response, text); }
From source file:com.consol.citrus.samples.bookstore.AddBook_Ok_2_IT.java
@CitrusTest(name = "AddBook_Ok_2_IT") public void addBookTest() { String isbn = "978-citrus:randomNumber(10)"; send(bookStoreClient).payload(createAddBookRequestMessage(isbn), marshaller).header("citrus_soap_action", "addBook"); receive(bookStoreClient).validationCallback(new XmlMarshallingValidationCallback<AddBookResponseMessage>() { @Override/*from w w w .j a va2 s . co m*/ public void validate(AddBookResponseMessage response, Map<String, Object> headers, TestContext context) { Assert.isTrue(response.isSuccess()); } }); }
From source file:org.oncoblocks.centromere.web.test.security.TokenTests.java
@Test public void getUsernameFromToken() { String token = tokenOperations.createToken(user); String username = tokenOperations.getUserNameFromToken(token); Assert.notNull(username);/*from w w w .j a v a2 s . c om*/ Assert.isTrue("user".equals(username)); }
From source file:org.openregistry.core.repository.xml.XmlBasedDisclosureRecalculationStrategyRepositoryImpl.java
public XmlBasedDisclosureRecalculationStrategyRepositoryImpl(final Resource resource) throws JAXBException, IOException { File disclosureCalculationStrategyFile = resource.getFile(); JAXBContext jaxbContext = JAXBContext.newInstance(XmlBasedDisclosureRecalculationStrategyImpl.class); Unmarshaller unMarshaller = jaxbContext.createUnmarshaller(); logger.info("Attempting to load Xml Disclosure recalculation strategy spec from [" + disclosureCalculationStrategyFile.getAbsolutePath() + "]"); Assert.isTrue(disclosureCalculationStrategyFile.isFile() && disclosureCalculationStrategyFile.canRead() && disclosureCalculationStrategyFile.getName().endsWith(".xml")); final FileReader fileReader = new FileReader(disclosureCalculationStrategyFile); disclosureRecalcualationStrategy = (DisclosureRecalculationStrategy) unMarshaller.unmarshal(fileReader); logger.info("Loaded Xml Disclosure recalculation strategy spec with name [" + disclosureRecalcualationStrategy.getName() + "] description [" + disclosureRecalcualationStrategy.getDescription() + "]"); }
From source file:org.oncoblocks.centromere.web.test.controller.RequestUtilTests.java
@Test public void requestUtilTest() throws Exception { Map<String, QueryParameterDescriptor> params = RequestUtils.getAvailableQueryParameters(CopyNumber.class); Assert.notNull(params);//from w w w . j a v a 2s .c om Assert.notEmpty(params); for (Map.Entry entry : params.entrySet()) { System.out.println(String.format("Param: %s, Type: %s", entry.getKey(), (entry.getValue()).toString())); } Assert.isTrue(params.containsKey("geneId")); Assert.isTrue(params.containsKey("gene.aliases")); Assert.isTrue(params.containsKey("gene")); Assert.isTrue(params.containsKey("signalOutside")); Assert.isTrue(params.get("signalOutside").getEvaluation().equals(Evaluation.OUTSIDE_INCLUSIVE)); }
From source file:org.oncoblocks.centromere.sql.test.SqlBuilderTests.java
@Test public void simpleQueryTest() { SqlBuilder sqlBuilder = new SqlBuilder(tableDescription); sqlBuilder.where(equal("name", "Joe")); String sql = sqlBuilder.toSql(); System.out.println(sql);/*w w w . ja v a 2 s. c o m*/ Assert.notNull(sql); List<Object> values = sqlBuilder.getQueryParameterValues(); Assert.notNull(values); Assert.notEmpty(values); Assert.isTrue(values.size() == 1); String name = (String) values.get(0); Assert.isTrue("Joe".equals(name)); }
From source file:com.yn.keygen.DefaultKeyGenerator.java
/** * Id./*from w w w .ja va 2 s .c o m*/ * * @param workerId Id */ public static void setWorkerId(final long workerId) { Assert.isTrue(workerId >= 0L && workerId < WORKER_ID_MAX_VALUE); DefaultKeyGenerator.workerId = workerId; }