List of usage examples for org.springframework.util Assert isTrue
@Deprecated public static void isTrue(boolean expression)
From source file:org.esco.portlet.flashinfo.FlashInfoDaoTest.java
@Test public void testJackson() throws Exception { mockServer.expect(MockRestRequestMatchers.requestTo("/mockGuestService")) .andRespond(MockRestResponseCreators.withSuccess(resource, MediaType.APPLICATION_OCTET_STREAM)); List<FlashInfo> fil = flashInfoResourceJackson.retrieveInfos("/mockGuestService"); //flashInfoResourceJackson.retrieveInfos("https://test-lycee.reciaent.fr/static/mockGuestService"); Assert.notNull(fil);//from w ww. j a v a 2 s . c o m Assert.notEmpty(fil); Assert.isTrue(fil.size() == 4); }
From source file:fr.rktv.iamcore.test.hibernate.AuthHibernateDAOTest.java
/** * Test case checking failure case of checkValidLicense method of Authenticate DAO * @throws IllegalArgumentException/*from w w w .java2s . co m*/ * @throws IllegalAccessException */ @Test public void checkValidLicenseTestFail() throws IllegalArgumentException, IllegalAccessException { Assert.isTrue(!authenticationDAO.checkValidLicense("ABCDERGDFDJHDJJDD")); }
From source file:org.oncoblocks.centromere.core.test.DataImportTests.java
@Test public void recordWriterTest() throws Exception { testRepository.deleteAll();//from w ww . java 2 s . c o m Assert.isTrue(testRepository.count() == 0); RepositoryRecordWriter<EntrezGene> writer = new RepositoryRecordWriter<>(testRepository); for (EntrezGene gene : EntrezGene.createDummyData()) { writer.writeRecord(gene); } Assert.isTrue(testRepository.count() == 5); }
From source file:org.oncoblocks.centromere.sql.test.GenericJdbcRepositoryTests.java
@Test public void countTest() { Long count = subjectRepository.count(); Assert.notNull(count); Assert.isTrue(count.equals(5L)); }
From source file:de.iew.services.impl.SketchPadServiceImpl.java
@PreAuthorize(value = "hasPermission(#sketchPadId, 'de.iew.sketchpad.domain.SketchPad', 'WRITE') and " + "hasPermission(#lineColorId, 'de.iew.sketchpad.domain.RgbColor', 'READ') and " + "hasPermission(#strokeId, 'de.iew.sketchpad.domain.Stroke', 'READ')") public Polygon createPolygon(Authentication sketchPadUser, long sketchPadId, double[] x, double[] y, long lineColorId, long strokeId) throws ModelNotFoundException { Assert.isTrue(x.length == y.length); SketchPad sketchPad = this.sketchPadDao.findById(sketchPadId); RgbColor lineColor = getColorBySketchPadIdAndId(sketchPadId, lineColorId); Stroke stroke = getStrokeBySketchPadAndId(sketchPadId, strokeId); Polygon polygon = new Polygon(); polygon.setState(Polygon.State.OPEN); polygon.setSketchPad(sketchPad);//from w w w. ja va 2 s.co m polygon.setLineColor(lineColor); polygon.setStroke(stroke); Segment segment; for (int segmentNum = 0; segmentNum < x.length; segmentNum++) { segment = new Segment(); segment.setOrdinalNumber(segmentNum); segment.setX(x[segmentNum]); segment.setY(y[segmentNum]); segment.setPolygon(polygon); polygon.getSegments().add(segment); } polygon = this.polygonDao.save(polygon); if (this.applicationEventChannel != null) { SketchPadEvent sketchPadEvent = new SketchPadEvent(this, SketchPadEvent.Action.POLYGON_CREATED, polygon, sketchPadUser); Message<SketchPadEvent> eventMessage = new GenericMessage<SketchPadEvent>(sketchPadEvent); this.applicationEventChannel.send(eventMessage); } // ACL aufsetzen this.aclEditorService.setupDemoSketchPadPolygonPermissionsIfSketchPadAdmin(polygon.getId()); this.aclEditorService.setupDemoSketchPadPolygonPermissionsIfSketchPadUser(polygon.getId()); return polygon; }
From source file:com.orange.cepheus.broker.SubscriptionsTest.java
@Test public void addSubscriptionWithNegativeDurationTest() throws SubscriptionException, URISyntaxException, SubscriptionPersistenceException { thrown.expect(SubscriptionException.class); thrown.expectMessage("negative duration is not allowed"); SubscribeContext subscribeContext = createSubscribeContextTemperature(); subscribeContext.setDuration("-PT10S"); subscriptions.addSubscription(subscribeContext); Assert.isTrue(subscriptionsRepository.getAllSubscriptions().size() == 0); }
From source file:org.oncoblocks.centromere.mongodb.test.MongoImportTests.java
@Test public void tempWriterTest() throws Exception { MongoImportTempFileWriter<EntrezGene> geneWriter = new MongoImportTempFileWriter<>(mongoTemplate); try {//from w w w . j ava2 s . c om geneWriter.open(tempFile.getAbsolutePath()); for (EntrezGene gene : genes) { geneWriter.writeRecord(gene); } } catch (Exception e) { e.printStackTrace(); } finally { if (geneWriter != null) geneWriter.close(); } Assert.isTrue(tempFile.canRead()); boolean flag = false; BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(tempFile)); String line = reader.readLine(); while (line != null) { Assert.notNull(line); System.out.println(line); line = reader.readLine(); } flag = true; } finally { if (reader != null) reader.close(); } Assert.isTrue(flag); }
From source file:org.trpr.platform.batch.impl.spring.admin.repository.MapJobExecutionDao.java
@Override public void saveJobExecution(JobExecution jobExecution) { Assert.isTrue(jobExecution.getId() == null); Long newId = currentId.getAndIncrement(); jobExecution.setId(newId);//from w w w . j a v a 2s.c o m jobExecution.incrementVersion(); this.addNewExecution(newId, copy(jobExecution)); }