Search in sources :

Example 96 with BigDecimal

use of java.math.BigDecimal in project agiletickets by caelum.

the class CalculadoraDePrecosTest method naoDeveAplicarAcrescimoNosPrimeirosIngressosQuandoForShow.

@Test
public void naoDeveAplicarAcrescimoNosPrimeirosIngressosQuandoForShow() {
    Sessao sessao = SessaoTestDataBuilder.umaSessao().deUmEspetaculoDoTipo(TipoDeEspetaculo.SHOW).comTotalIngressos(200).comIngressoReservados(15).comOPreco(100.0).build();
    BigDecimal precoTotal = CalculadoraDePrecos.calcula(sessao, 1);
    assertEquals(0, BigDecimal.valueOf(100.0).compareTo(precoTotal));
}
Also used : Sessao(br.com.caelum.agiletickets.models.Sessao) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 97 with BigDecimal

use of java.math.BigDecimal in project agiletickets by caelum.

the class CalculadoraDePrecosTest method naoDeveAplicarAcrescimoNosPrimeirosIngressosQuandoForOrquestra.

@Test
public void naoDeveAplicarAcrescimoNosPrimeirosIngressosQuandoForOrquestra() {
    Sessao sessao = SessaoTestDataBuilder.umaSessao().deUmEspetaculoDoTipo(TipoDeEspetaculo.ORQUESTRA).comTotalIngressos(70).comIngressoReservados(10).comOPreco(1000.0).comDuracaoEmMinutos(60).build();
    BigDecimal precoTotal = CalculadoraDePrecos.calcula(sessao, 1);
    assertEquals(0, BigDecimal.valueOf(1000.0).compareTo(precoTotal));
}
Also used : Sessao(br.com.caelum.agiletickets.models.Sessao) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 98 with BigDecimal

use of java.math.BigDecimal in project agiletickets by caelum.

the class CalculadoraDePrecosTest method deveConsiderarQuantidadeAoCalcularPrecoTotal.

@Test
public void deveConsiderarQuantidadeAoCalcularPrecoTotal() {
    Sessao sessao = SessaoTestDataBuilder.umaSessao().deUmEspetaculoDoTipo(TipoDeEspetaculo.TEATRO).comOPreco(10.0).build();
    BigDecimal precoTotal = CalculadoraDePrecos.calcula(sessao, 9);
    assertEquals(0, BigDecimal.valueOf(90.0).compareTo(precoTotal));
}
Also used : Sessao(br.com.caelum.agiletickets.models.Sessao) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 99 with BigDecimal

use of java.math.BigDecimal in project agiletickets by caelum.

the class CalculadoraDePrecosTest method naoDeveAplicarAcrescimoNosPrimeirosIngressosQuandoForBallet.

@Test
public void naoDeveAplicarAcrescimoNosPrimeirosIngressosQuandoForBallet() {
    Sessao sessao = SessaoTestDataBuilder.umaSessao().deUmEspetaculoDoTipo(TipoDeEspetaculo.BALLET).comTotalIngressos(50).comIngressoReservados(5).comOPreco(500.0).comDuracaoEmMinutos(50).build();
    BigDecimal precoTotal = CalculadoraDePrecos.calcula(sessao, 1);
    assertEquals(0, BigDecimal.valueOf(500.0).compareTo(precoTotal));
}
Also used : Sessao(br.com.caelum.agiletickets.models.Sessao) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 100 with BigDecimal

use of java.math.BigDecimal in project agiletickets by caelum.

the class CalculadoraDePrecosTest method naoDeveAplicarAcrescimoNosPrimeirosIngressosQuandoForCinema.

@Test
public void naoDeveAplicarAcrescimoNosPrimeirosIngressosQuandoForCinema() {
    Sessao sessao = SessaoTestDataBuilder.umaSessao().deUmEspetaculoDoTipo(TipoDeEspetaculo.CINEMA).comTotalIngressos(100).comIngressoReservados(10).comOPreco(20.0).build();
    BigDecimal precoTotal = CalculadoraDePrecos.calcula(sessao, 1);
    assertEquals(0, BigDecimal.valueOf(20.0).compareTo(precoTotal));
}
Also used : Sessao(br.com.caelum.agiletickets.models.Sessao) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

BigDecimal (java.math.BigDecimal)4643 Test (org.junit.Test)634 BigInteger (java.math.BigInteger)624 Test (org.testng.annotations.Test)573 LocalDate (org.joda.time.LocalDate)409 ArrayList (java.util.ArrayList)351 ResultSet (java.sql.ResultSet)222 Timestamp (java.sql.Timestamp)205 PreparedStatement (java.sql.PreparedStatement)201 SQLException (java.sql.SQLException)159 Invoice (org.killbill.billing.invoice.api.Invoice)148 Date (java.util.Date)146 UUID (java.util.UUID)144 MathContext (java.math.MathContext)140 DateTime (org.joda.time.DateTime)132 HashMap (java.util.HashMap)130 RoundingMode (java.math.RoundingMode)128 List (java.util.List)113 InvoiceItem (org.killbill.billing.invoice.api.InvoiceItem)104 Session (org.hibernate.Session)96