congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
BigDecimalCloseTo.closeTo
Code IndexAdd Tabnine to your IDE (free)

How to use
closeTo
method
in
org.hamcrest.number.BigDecimalCloseTo

Best Java code snippets using org.hamcrest.number.BigDecimalCloseTo.closeTo (Showing top 20 results out of 315)

origin: org.hamcrest/hamcrest-all

/**
 * Creates a matcher of {@link java.math.BigDecimal}s that matches when an examined BigDecimal is equal
 * to the specified <code>operand</code>, within a range of +/- <code>error</code>. The comparison for equality
 * is done by BigDecimals {@link java.math.BigDecimal#compareTo(java.math.BigDecimal)} method.
 * <p/>
 * For example:
 * <pre>assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))</pre>
 * 
 * @param operand
 *     the expected value of matching BigDecimals
 * @param error
 *     the delta (+/-) within which matches will be allowed
 */
public static org.hamcrest.Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand, java.math.BigDecimal error) {
 return org.hamcrest.number.BigDecimalCloseTo.closeTo(operand, error);
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher of {@link java.math.BigDecimal}s that matches when an examined BigDecimal is equal
 * to the specified <code>operand</code>, within a range of +/- <code>error</code>. The comparison for equality
 * is done by BigDecimals {@link java.math.BigDecimal#compareTo(java.math.BigDecimal)} method.
 * For example:
 * <pre>assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))</pre>
 * 
 * @param operand
 *     the expected value of matching BigDecimals
 * @param error
 *     the delta (+/-) within which matches will be allowed
 */
public static org.hamcrest.Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand, java.math.BigDecimal error) {
 return org.hamcrest.number.BigDecimalCloseTo.closeTo(operand, error);
}
origin: hamcrest/JavaHamcrest

@Override
protected Matcher<?> createMatcher() {
 BigDecimal irrelevant = new BigDecimal("0.01");
 return closeTo(irrelevant, irrelevant);
}

origin: org.hamcrest/java-hamcrest

/**
 * Creates a matcher of {@link java.math.BigDecimal}s that matches when an examined BigDecimal is equal
 * to the specified <code>operand</code>, within a range of +/- <code>error</code>. The comparison for equality
 * is done by BigDecimals {@link java.math.BigDecimal#compareTo(java.math.BigDecimal)} method.
 * For example:
 * <pre>assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))</pre>
 * 
 * @param operand
 *     the expected value of matching BigDecimals
 * @param error
 *     the delta (+/-) within which matches will be allowed
 */
public static org.hamcrest.Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand, java.math.BigDecimal error) {
 return org.hamcrest.number.BigDecimalCloseTo.closeTo(operand, error);
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testDeposit() throws Exception {
  BigDecimal start = service.getBalance(1L);
  BigDecimal amount = new BigDecimal("50.0");
  service.deposit(1L, amount);
  BigDecimal finish = start.add(amount);
  assertThat(finish, is(closeTo(service.getBalance(1L),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testWithdraw() throws Exception {
  BigDecimal start = service.getBalance(1L);
  BigDecimal amount = new BigDecimal("50.0");
  service.withdraw(1L, amount);
  BigDecimal finish = start.subtract(amount);
  assertThat(finish, is(closeTo(service.getBalance(1L),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testDeposit() throws Exception {
  BigDecimal start = service.getBalance(1L);
  BigDecimal amount = new BigDecimal("50.0");
  service.deposit(1L, amount);
  BigDecimal finish = start.add(amount);
  assertThat(finish, is(closeTo(service.getBalance(1L),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testWithdraw() throws Exception {
  BigDecimal start = service.getBalance(1L);
  BigDecimal amount = new BigDecimal("50.0");
  service.withdraw(1L, amount);
  BigDecimal finish = start.subtract(amount);
  assertThat(finish, is(closeTo(service.getBalance(1L),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testWithdraw() throws Exception {
  BigDecimal start = service.getBalance(1L);
  BigDecimal amount = new BigDecimal("50.0");
  service.withdraw(1L, amount);
  BigDecimal finish = start.subtract(amount);
  assertThat(finish, is(closeTo(service.getBalance(1L),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testDeposit() throws Exception {
  BigDecimal start = service.getBalance(1L);
  BigDecimal amount = new BigDecimal("50.0");
  service.deposit(1L, amount);
  BigDecimal finish = start.add(amount);
  assertThat(finish, is(closeTo(service.getBalance(1L),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testGetAccount() throws Exception {
  Account account = repository.getAccount(1L);
  assertThat(account.getId(), is(1L));
  assertThat(new BigDecimal("100.0"),
      is(closeTo(account.getBalance(), new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testGetAccount() throws Exception {
  Account account = repository.findOne(1L);
  assertThat(account.getId(), is(1L));
  assertThat(new BigDecimal("100.0"),
      is(closeTo(account.getBalance(), new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testCreateAccount() throws Exception {
  Long id = repository.createAccount(new BigDecimal("250.00"));
  assertThat(id, is(notNullValue()));
  Account account = repository.getAccount(id);
  assertThat(account.getId(), is(id));
  assertThat(account.getBalance(), is(closeTo(new BigDecimal("250.0"),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testCreateAccount() throws Exception {
  Long id = repository.createAccount(new BigDecimal("250.00"));
  assertThat(id, is(notNullValue()));
  Account account = repository.getAccount(id);
  assertThat(account.getId(), is(id));
  assertThat(account.getBalance(), is(closeTo(new BigDecimal("250.0"),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testGetAccount() throws Exception {
  Account account = repository.getAccount(1L);
  assertThat(account.getId(), is(1L));
  assertThat(new BigDecimal("100.0"),
      is(closeTo(account.getBalance(), new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testGetAccount() throws Exception {
  Account account = repository.findOne(1L);
  assertThat(account.getId(), is(1L));
  assertThat(new BigDecimal("100.0"),
      is(closeTo(account.getBalance(), new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testCreateAccount() throws Exception {
  Account account = new Account(99L, new BigDecimal("250.00"));
  repository.save(account);
  Long id = account.getId();
  assertThat(id, is(notNullValue()));
  Account again = repository.findOne(id);
  assertThat(again.getId(), is(id));
  assertThat(again.getBalance(), is(closeTo(new BigDecimal("250.0"),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testUpdateAccount() throws Exception {
  Account account = repository.findOne(1L);
  BigDecimal current = account.getBalance();
  BigDecimal amount = new BigDecimal("50.0");
  account.setBalance(current.add(amount));
  repository.save(account);
  Account again = repository.findOne(1L);
  assertThat(again.getBalance(), is(closeTo(current.add(amount),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testUpdateAccount() throws Exception {
  Account account = repository.getAccount(1L);
  BigDecimal current = account.getBalance();
  BigDecimal amount = new BigDecimal("50.0");
  account.setBalance(current.add(amount));
  repository.updateAccount(account);
  Account again = repository.getAccount(1L);
  assertThat(again.getBalance(), is(closeTo(current.add(amount),
      new BigDecimal("0.01"))));
}
origin: kousen/Spring-Framework-Essentials

@Test
public void testUpdateAccount() throws Exception {
  Account account = repository.getAccount(1L);
  BigDecimal current = account.getBalance();
  BigDecimal amount = new BigDecimal("50.0");
  account.setBalance(current.add(amount));
  repository.updateAccount(account);
  Account again = repository.getAccount(1L);
  assertThat(again.getBalance(), is(closeTo(current.add(amount),
      new BigDecimal("0.01"))));
}
org.hamcrest.numberBigDecimalCloseTocloseTo

Javadoc

Creates a matcher of java.math.BigDecimals that matches when an examined BigDecimal is equal to the specified operand, within a range of +/- error. The comparison for equality is done by BigDecimals java.math.BigDecimal#compareTo(java.math.BigDecimal) method. For example:
assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))

Popular methods of BigDecimalCloseTo

  • <init>
  • actualDelta

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Permission (java.security)
    Legacy security code; do not use.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Reference (javax.naming)
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now