List of usage examples for java.math BigDecimal TEN
BigDecimal TEN
To view the source code for java.math BigDecimal TEN.
Click Source Link
From source file:md.ibanc.rm.controllers.rest.RestExchangeRateController.java
@RequestMapping(value = "/rest/valueExchangeRate", method = RequestMethod.GET) public ResponseEntity<List<ExchangeRate>> getAllExchangeRate() { ExchangeRate exchangeRate = new ExchangeRate(); exchangeRate.setBuyCurs(BigDecimal.ONE); exchangeRate.setDataIns(new Date()); exchangeRate.setOfficialCurs(BigDecimal.TEN); exchangeRate.setSellCurs(BigDecimal.TEN); exchangeRateService.save(exchangeRate); List<ExchangeRate> ExchangeRateRestList = (ArrayList<ExchangeRate>) exchangeRateService.findAll(); return new ResponseEntity<>(ExchangeRateRestList, HttpStatus.OK); }
From source file:nl.strohalm.cyclos.utils.conversion.FixedLengthNumberConverter.java
public FixedLengthNumberConverter(final Class<T> numberType, final int scale) { this.numberType = numberType; this.scale = scale; divisor = BigDecimal.TEN.pow(scale); }
From source file:computech.model.VideoCatalogIntegrationTests.java
@Test public void lazyLoadExceptionTest() { Iterable<Article> result = catalog2.findByType(ArticleType.NOTEBOOK); assertThat(result, is(iterableWithSize(2))); Article comp = new Article("TestPC", "Image", Money.of(BigDecimal.TEN, Currencies.EURO), "d2", ArticleType.NOTEBOOK);/*from w w w .j av a 2s. c o m*/ catalog2.save(comp); result = catalog2.findByType(ArticleType.NOTEBOOK); assertThat(result, is(iterableWithSize(3))); Iterator<Article> it = result.iterator(); while (it.hasNext()) { Article d = it.next(); assertThat(d.getType(), is(ArticleType.NOTEBOOK)); Iterable<String> iterable = d.getCategories(); assertThat(iterable, is(iterableWithSize(0))); } assertThat(result, hasItem(comp)); }
From source file:cz.muni.fi.pa165.legomanager.services.LegoKitServiceImplTest.java
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); legoKit = createLegoKit(BigDecimal.TEN, 16, "Star Wars: Death Star"); legoKit.setId(1L);// www . j a v a2 s . c o m }
From source file:facade.RoomFacadeTest.java
@BeforeMethod public void beforeMethod() throws ParseException { r1 = new Room(); r2 = new Room(); r1.setNumber(1);/*from www . j a v a2s . c o m*/ r2.setNumber(2); r1.setPrice(BigDecimal.ONE); r2.setPrice(BigDecimal.TEN); r1.setType(RoomType.SingleRoom); r2.setType(RoomType.DoubleRoom); }
From source file:org.thymeleaf.util.EvaluationUtilTest.java
@Test public void convertToBooleanTest() { Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(null)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Boolean.TRUE)); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Boolean.FALSE)); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(BigDecimal.ZERO)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigDecimal.ONE)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigDecimal.TEN)); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(BigInteger.ZERO)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigInteger.ONE)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigInteger.TEN)); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Double.valueOf(0.0d))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Float.valueOf(0.0f))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(0.1d))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(0.1f))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(-0.1d))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(-0.1f))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(Double.MAX_VALUE))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(Float.MAX_VALUE))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(Double.MIN_VALUE))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(Float.MIN_VALUE))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Character.valueOf((char) 0))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('x'))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('0'))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('1'))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("true")); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("false")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("yes")); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("no")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("on")); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("off")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("sky")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("high above")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("true"))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("false"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("yes"))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("no"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("on"))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("off"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("sky"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("high above"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(EvaluationUtil.class)); }
From source file:cz.cas.lib.proarc.common.workflow.FilterFindParameterQueryTest.java
@Test public void testFilterNoDbParam() { List<TaskParameterView> params = Collections.emptyList(); TaskParameterFilter filter = new TaskParameterFilter(); filter.setTaskId(BigDecimal.TEN); filter.setLocale(Locale.ENGLISH); Task task = new Task(); task.setTypeRef("task.id1"); task.setId(filter.getTaskId());/*from w w w. j a v a 2 s . co m*/ List<TaskParameterView> result = new FilterFindParameterQuery(wp).filter(params, filter, task, wp.getProfiles()); assertEquals(2, result.size()); assertEquals("param.id1", result.get(0).getParamRef()); assertEquals(DisplayType.TEXT, result.get(0).getDisplayType()); assertEquals(task.getTypeRef(), result.get(0).getTaskProfileName()); assertEquals(filter.getTaskId(), result.get(0).getTaskId()); }
From source file:org.sejda.impl.pdfbox.component.PdfHeaderFooterWriter.java
public void writeFooter(SetHeaderFooterParameters parameters) throws TaskIOException { PDFont font = defaultIfNull(getStandardType1Font(parameters.getFont()), PDType1Font.HELVETICA); BigDecimal fontSize = defaultIfNull(parameters.getFontSize(), BigDecimal.TEN); HorizontalAlign horAlignment = defaultIfNull(parameters.getHorizontalAlign(), HorizontalAlign.CENTER); VerticalAlign verAlignment = defaultIfNull(parameters.getVerticalAlign(), VerticalAlign.BOTTOM); SortedSet<Integer> pages = parameters.getPageRange().getPages(documentHandler.getNumberOfPages()); LOG.debug("Found {} pages to apply header or footer", pages.size()); Integer labelPageNumber = parameters.getNumbering().getLogicalPageNumber(); for (Integer pageNumber : pages) { String label = parameters.styledLabelFor(labelPageNumber); PDPage page = documentHandler.getPage(pageNumber); PDRectangle pageSize = page.findCropBox(); try {/* w ww. ja v a 2 s. c om*/ float stringWidth = font.getStringWidth(label) * fontSize.floatValue() / 1000f; float xPosition = horAlignment.position(pageSize.getWidth(), stringWidth, DEFAULT_MARGIN); float yPosition = verAlignment.position(pageSize.getHeight(), DEFAULT_MARGIN); PDPageContentStream contentStream = new PDPageContentStream( documentHandler.getUnderlyingPDDocument(), page, true, true); contentStream.beginText(); contentStream.setFont(font, fontSize.floatValue()); contentStream.moveTextPositionByAmount(xPosition, yPosition); contentStream.drawString(label); contentStream.endText(); contentStream.close(); } catch (IOException e) { throw new TaskIOException("An error occurred writing the header or footer of the page.", e); } labelPageNumber++; } }
From source file:com.redhat.lightblue.metadata.types.BigDecimalTypeTest.java
@Test public void testFromJson() { JsonNode jsonNode = JsonNodeFactory.withExactBigDecimals(true).numberNode(BigDecimal.TEN); Object fromJson = bigDecimalType.fromJson(jsonNode); assertTrue(fromJson instanceof BigDecimal); }
From source file:br.edu.ifrn.conta.servico.LancamentoServicoIT.java
@Test(expected = IllegalArgumentException.class) public void lancamentoComContaEntradaInvalida() { Lancamento lancamento = Lancamento.builder().contaEntrada(this.contaCreditoFabrica.estagio()) .contaSaida(this.contaPatrimonioFabrica.poupanca()).valor(BigDecimal.TEN).data(new Date()) .dono(this.donoFabrica.papai()).build(); this.lancamentoServico.save(lancamento); }