Example usage for java.math BigDecimal TEN

List of usage examples for java.math BigDecimal TEN

Introduction

In this page you can find the example usage for java.math BigDecimal TEN.

Prototype

BigDecimal TEN

To view the source code for java.math BigDecimal TEN.

Click Source Link

Document

The value 10, with a scale of 0.

Usage

From source file:org.openvpms.web.workspace.workflow.checkin.CheckInWorkflowTestCase.java

/**
 * Verifies that changing the clinician on an invoice item propagates through to the documents associated
 * with the invoice.//from ww w .  ja  v  a2 s . c  o m
 */
@Test
public void testChangeClinicianOnInvoiceItem() {
    Date startTime = TestHelper.getDatetime("2013-01-01 09:00:00");
    Act appointment = createAppointment(startTime, customer, patient, clinician);
    CheckInWorkflowRunner workflow = new CheckInWorkflowRunner(appointment, getPractice(), context);
    workflow.setArrivalTime(startTime);
    workflow.start();

    fireDialogButton(workflow.getSelectionDialog(), PopupDialog.SKIP_ID);
    fireDialogButton(workflow.getWeightEditor(), PopupDialog.SKIP_ID);
    workflow.printPatientDocuments(PopupDialog.SKIP_ID);

    Product product = CustomerChargeTestHelper.createProduct(ProductArchetypes.MEDICATION, BigDecimal.TEN,
            getPractice());
    addDocumentTemplate(product);
    addDocumentTemplate(product);

    // edit the charge
    VisitEditorDialog dialog = workflow.getVisitEditorDialog();
    dialog.getEditor().selectCharges(); // make sure the charges tab is selected, to enable the Apply button
    VisitChargeItemEditor itemEditor = workflow.addVisitInvoiceItem(patient, clinician, product);
    itemEditor.setClinician(clinician);
    fireDialogButton(dialog, PopupDialog.APPLY_ID);

    List<Act> documents1 = getDocuments(itemEditor);
    assertEquals(2, documents1.size());

    User clinician2 = TestHelper.createClinician();
    itemEditor.setClinician(clinician2);
    fireDialogButton(dialog, PopupDialog.OK_ID);

    List<Act> documents2 = getDocuments(itemEditor);
    assertEquals(2, documents2.size());
    assertEquals(clinician2, getClinician(documents2.get(0)));
    assertEquals(clinician2, getClinician(documents2.get(1)));

    workflow.checkEvent(patient, clinician, ActStatus.IN_PROGRESS);
    workflow.checkComplete(true, customer, patient, context);

    assertTrue(errors.isEmpty());
}

From source file:org.openestate.io.is24_xml.Is24XmlUtils.java

public static String printZahl31(BigDecimal value) {
    if (value == null || value.compareTo(BigDecimal.ZERO) != 1 || value.compareTo(BigDecimal.TEN.pow(2)) != -1)
        throw new IllegalArgumentException("Can't print decimal value '" + value + "'!");
    else// w ww . ja va  2  s  .c o  m
        return DatatypeConverter.printDecimal(value.setScale(1, BigDecimal.ROUND_HALF_UP));
}

From source file:org.openestate.io.is24_xml.Is24XmlUtils.java

public static String printZahl32(BigDecimal value) {
    if (value == null || value.compareTo(BigDecimal.ZERO) != 1 || value.compareTo(BigDecimal.TEN.pow(1)) != -1)
        throw new IllegalArgumentException("Can't print decimal value '" + value + "'!");
    else// www.j ava 2 s  .co m
        return DatatypeConverter.printDecimal(value.setScale(2, BigDecimal.ROUND_HALF_UP));
}

From source file:org.openestate.io.is24_xml.Is24XmlUtils.java

public static String printZahl42(BigDecimal value) {
    if (value == null || value.compareTo(BigDecimal.ZERO) != 1 || value.compareTo(BigDecimal.TEN.pow(2)) != -1)
        throw new IllegalArgumentException("Can't print decimal value '" + value + "'!");
    else// w  w  w. j a va2 s  .c o m
        return DatatypeConverter.printDecimal(value.setScale(2, BigDecimal.ROUND_HALF_UP));
}

From source file:alfio.manager.WaitingQueueManagerIntegrationTest.java

@Test
public void testAssignTicketToWaitingQueueUnboundedCategorySelected() {
    LocalDateTime start = LocalDateTime.now().minusHours(1);
    LocalDateTime end = LocalDateTime.now().plusHours(1);

    List<TicketCategoryModification> categories = Arrays.asList(
            new TicketCategoryModification(null, "default", AVAILABLE_SEATS,
                    new DateTimeModification(start.toLocalDate(), start.toLocalTime()),
                    new DateTimeModification(end.toLocalDate(), end.toLocalTime()), DESCRIPTION, BigDecimal.TEN,
                    false, "", false, null, null, null, null, null),
            new TicketCategoryModification(null, "default2", AVAILABLE_SEATS,
                    new DateTimeModification(start.toLocalDate(), start.toLocalTime()),
                    new DateTimeModification(end.toLocalDate(), end.toLocalTime()), DESCRIPTION, BigDecimal.TEN,
                    false, "", false, null, null, null, null, null));

    configurationManager.saveSystemConfiguration(ConfigurationKeys.ENABLE_WAITING_QUEUE, "true");

    Event event = initEvent(categories, organizationRepository, userManager, eventManager, eventRepository)
            .getKey();/* w w  w .ja va  2s .com*/

    List<TicketCategory> ticketCategories = ticketCategoryRepository.findByEventId(event.getId());
    TicketCategory first = ticketCategories.get(0);
    TicketCategory second = ticketCategories.get(1);

    TicketReservationModification tr2 = new TicketReservationModification();
    tr2.setAmount(1);
    tr2.setTicketCategoryId(second.getId());

    TicketReservationModification tr3 = new TicketReservationModification();
    tr3.setAmount(1);
    tr3.setTicketCategoryId(first.getId());

    reserveTickets(event, first, AVAILABLE_SEATS - 2);

    String reservationIdSingleFirst = reserveTickets(event, second, 1);
    String reservationIdSingleSecond = reserveTickets(event, second, 1);

    assertEquals(0, eventRepository.findStatisticsFor(event.getId()).getDynamicAllocation());

    assertTrue(waitingQueueManager.subscribe(event, customerJohnDoe(event), "john@doe.com", first.getId(),
            Locale.ENGLISH));
    assertTrue(waitingQueueManager.subscribe(event, new CustomerName("John Doe 2", "John", "Doe 2", event),
            "john@doe2.com", second.getId(), Locale.ENGLISH));

    ticketReservationManager.deleteOfflinePayment(event, reservationIdSingleFirst, false);
    ticketReservationManager.deleteOfflinePayment(event, reservationIdSingleSecond, false);

    List<Triple<WaitingQueueSubscription, TicketReservationWithOptionalCodeModification, ZonedDateTime>> subscriptions = waitingQueueManager
            .distributeSeats(event).collect(Collectors.toList());
    assertEquals(2, subscriptions.size());
    Triple<WaitingQueueSubscription, TicketReservationWithOptionalCodeModification, ZonedDateTime> subscriptionDetail = subscriptions
            .get(0);
    assertEquals("john@doe.com", subscriptionDetail.getLeft().getEmailAddress());
    TicketReservationWithOptionalCodeModification reservation = subscriptionDetail.getMiddle();
    assertEquals(Integer.valueOf(first.getId()), reservation.getTicketCategoryId());
    assertEquals(Integer.valueOf(1), reservation.getAmount());
    assertTrue(subscriptionDetail.getRight().isAfter(ZonedDateTime.now()));

    subscriptionDetail = subscriptions.get(1);
    assertEquals("john@doe2.com", subscriptionDetail.getLeft().getEmailAddress());
    reservation = subscriptionDetail.getMiddle();
    assertEquals(Integer.valueOf(second.getId()), reservation.getTicketCategoryId());
    assertEquals(Integer.valueOf(1), reservation.getAmount());
    assertTrue(subscriptionDetail.getRight().isAfter(ZonedDateTime.now()));
}

From source file:alfio.manager.EventManagerIntegrationTest.java

@Test
public void testAddBoundedCategoryToUnboundedEvent() {
    List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null,
            "default", 0, new DateTimeModification(LocalDate.now(), LocalTime.now()),
            new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "",
            false, null, null, null, null, null));
    Pair<Event, String> pair = initEvent(categories, organizationRepository, userManager, eventManager,
            eventRepository);//from w w  w .jav a2s.co m
    Event event = pair.getKey();
    TicketCategoryModification tcm = new TicketCategoryModification(null, "default", 10,
            new DateTimeModification(LocalDate.now(), LocalTime.now()),
            new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "",
            true, null, null, null, null, null);
    Result<Integer> result = eventManager.insertCategory(event, tcm, pair.getValue());
    assertTrue(result.isSuccess());
    List<Ticket> tickets = ticketRepository.findFreeByEventId(event.getId());
    assertNotNull(tickets);
    assertFalse(tickets.isEmpty());
    assertEquals(10, tickets.size());
    assertEquals(10, tickets.stream().filter(t -> t.getCategoryId() == null).count());
    assertEquals(10,
            ticketRepository.countReleasedTicketInCategory(event.getId(), result.getData()).intValue());
}

From source file:org.openestate.io.is24_xml.Is24XmlUtils.java

public static String printZahl52(BigDecimal value) {
    if (value == null || value.compareTo(BigDecimal.ZERO) != 1 || value.compareTo(BigDecimal.TEN.pow(3)) != -1)
        throw new IllegalArgumentException("Can't print decimal value '" + value + "'!");
    else/*w w w .  j  a  v  a2  s . co  m*/
        return DatatypeConverter.printDecimal(value.setScale(2, BigDecimal.ROUND_HALF_UP));
}

From source file:org.openestate.io.is24_xml.Is24XmlUtils.java

public static String printZahl62(BigDecimal value) {
    if (value == null || value.compareTo(BigDecimal.ZERO) != 1 || value.compareTo(BigDecimal.TEN.pow(4)) != -1)
        throw new IllegalArgumentException("Can't print decimal value '" + value + "'!");
    else//from   w  w  w  . j  a va 2  s.c  o m
        return DatatypeConverter.printDecimal(value.setScale(2, BigDecimal.ROUND_HALF_UP));
}

From source file:fragment.web.AdminControllerTest.java

@Test
public void testEditInitialDeposit() throws Exception {

    AccountType accountType = accountTypeDAO.find(3L);
    accountType.getAccountTypeCreditExposureList().get(0).setInitialDeposit(BigDecimal.TEN);
    AccountTypeForm form = new AccountTypeForm(accountType);
    BindingResult result = validate(form);
    String resultString = controller.editInitialDeposit(form, result, map);
    Assert.assertNotNull(resultString);//from w ww  .ja  va 2  s  .  c o m
    Assert.assertEquals("success", resultString);
    BigDecimal bd = BigDecimal.TEN;
    bd = bd.setScale(4);
    Assert.assertEquals(bd, accountType.getAccountTypeCreditExposureList().get(0).getInitialDeposit());
}

From source file:org.openestate.io.is24_xml.Is24XmlUtils.java

public static String printZahl72(BigDecimal value) {
    if (value == null || value.compareTo(BigDecimal.ZERO) != 1 || value.compareTo(BigDecimal.TEN.pow(5)) != -1)
        throw new IllegalArgumentException("Can't print decimal value '" + value + "'!");
    else/*w w  w.  j  av  a 2 s .c  om*/
        return DatatypeConverter.printDecimal(value.setScale(2, BigDecimal.ROUND_HALF_UP));
}