/**
   * @verifies log error if rouding item id is set but item cannot be found (and hence is null)
   * @see CashierOptionsServiceGpImpl#getOptions()
   */
  @Test
  public void getOptions_shouldLogErrorIfRoundingItemIsNullDespiteIdGiven() throws Exception {

    when(adminService.getGlobalProperty(ModuleSettings.RECEIPT_REPORT_ID_PROPERTY))
        .thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.ROUNDING_MODE_PROPERTY))
        .thenReturn(CashierOptions.RoundingMode.FLOOR.toString());
    when(adminService.getGlobalProperty(ModuleSettings.ROUND_TO_NEAREST_PROPERTY)).thenReturn("5");
    when(adminService.getGlobalProperty(ModuleSettings.ROUNDING_ITEM_ID)).thenReturn("273423");
    when(adminService.getGlobalProperty(ModuleSettings.TIMESHEET_REQUIRED_PROPERTY))
        .thenReturn(null);

    Logger logger = Logger.getLogger(CashierOptionsServiceGpImpl.class);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Layout layout = new SimpleLayout();
    Appender appender = new WriterAppender(layout, out);
    logger.addAppender(appender);

    try {
      optionsService.getOptions();
      String logMsg = out.toString();
      assertNotNull(logMsg);
      assertFalse((logMsg.trim()).equals(""));
    } finally {
      logger.removeAppender(appender);
    }
  }
  /**
   * @verifies not throw exception if numeric options are null
   * @see CashierOptionsServiceGpImpl#getOptions()
   */
  @Test
  public void getOptions_shouldNotThrowExceptionIfNumericOptionsAreNull() throws Exception {
    when(adminService.getGlobalProperty(ModuleSettings.RECEIPT_REPORT_ID_PROPERTY))
        .thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.ROUNDING_MODE_PROPERTY)).thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.ROUND_TO_NEAREST_PROPERTY)).thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.ROUNDING_ITEM_ID)).thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.TIMESHEET_REQUIRED_PROPERTY))
        .thenReturn(null);

    CashierOptions options = optionsService.getOptions();

    Assert.assertNotNull(options);
  }
  /**
   * @verifies default to false if timesheet required is not specified
   * @see CashierOptionsServiceGpImpl#getOptions()
   */
  @Test
  public void getOptions_shouldDefaultToFalseIfTimesheetRequiredIsNotSpecified() throws Exception {
    when(adminService.getGlobalProperty(ModuleSettings.RECEIPT_REPORT_ID_PROPERTY))
        .thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.ROUNDING_MODE_PROPERTY)).thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.ROUND_TO_NEAREST_PROPERTY)).thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.ROUNDING_ITEM_ID)).thenReturn(null);
    when(adminService.getGlobalProperty(ModuleSettings.TIMESHEET_REQUIRED_PROPERTY))
        .thenReturn(null);

    CashierOptions options = optionsService.getOptions();

    Assert.assertNotNull(options);
    Assert.assertEquals(false, options.isTimesheetRequired());
  }
  /**
   * @verifies load cashier options from the database
   * @see CashierOptionsServiceGpImpl#getOptions()
   */
  @Test
  public void getOptions_shouldLoadCashierOptionsFromTheDatabase() throws Exception {
    when(adminService.getGlobalProperty(ModuleSettings.RECEIPT_REPORT_ID_PROPERTY)).thenReturn("1");
    when(adminService.getGlobalProperty(ModuleSettings.ROUNDING_MODE_PROPERTY))
        .thenReturn(CashierOptions.RoundingMode.MID.toString());
    when(adminService.getGlobalProperty(ModuleSettings.ROUND_TO_NEAREST_PROPERTY)).thenReturn("5");
    when(adminService.getGlobalProperty(ModuleSettings.ROUNDING_ITEM_ID)).thenReturn("1");
    when(adminService.getGlobalProperty(ModuleSettings.TIMESHEET_REQUIRED_PROPERTY))
        .thenReturn("true");

    Item item = new Item();
    when(itemService.getById(1)).thenReturn(item);

    CashierOptions options = optionsService.getOptions();

    Assert.assertNotNull(options);
    Assert.assertEquals(1, options.getDefaultReceiptReportId());
    Assert.assertEquals(CashierOptions.RoundingMode.MID, options.getRoundingMode());
    Assert.assertEquals(new BigDecimal(5), options.getRoundToNearest());
    Assert.assertEquals(item.getUuid(), options.getRoundingItemUuid());
    Assert.assertEquals(true, options.isTimesheetRequired());
  }