Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Timezone fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dussab committed Feb 14, 2013
1 parent 21d13c9 commit abe302a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
Expand Up @@ -23,6 +23,7 @@

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
Expand Down Expand Up @@ -79,7 +80,6 @@ public class ServiceTestConfiguration {
public static String PASSWORD = "password";
public static String BAD_USER_ID = "NA";
public static String BAD_PASSWORD = "NA";

//Order constants
public static Integer ORDER_ID = 555;
public static BigDecimal ORDER_PRICE = BigDecimal.valueOf(100);
Expand Down Expand Up @@ -123,6 +123,8 @@ public class ServiceTestConfiguration {
public static String PAGE_SIZE = "pageSize";
public static String TOTAL_RECORDS = "totalRecords";
public static Long RESULT_COUNT = new Long(1);
public static String DATE = new SimpleDateFormat("yyyy-MM-dd").format(new Date(1329759342904l));

@Bean
public TradingService tradingService() {
TradingService tradingService = Mockito.mock(TradingService.class);
Expand Down
Expand Up @@ -33,19 +33,18 @@
*/

public class AccountControllerTest extends AbstractSecureControllerTest {
private static String DATE = "2012-02-20";

@Test
public void getQuoteBySymbolJson() throws Exception {
mockMvc.perform(get("/account/" + ServiceTestConfiguration.ACCOUNT_ID).accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().mimeType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.accountid").value(ServiceTestConfiguration.ACCOUNT_ID))
.andExpect(jsonPath("$.creationdate").value(DATE))
.andExpect(jsonPath("$.creationdate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.openbalance").value(ServiceTestConfiguration.ACCOUNT_OPEN_BALANCE.doubleValue()))
.andExpect(jsonPath("$.logoutcount").value(ServiceTestConfiguration.LOGOUT_COUNT.intValue()))
.andExpect(jsonPath("$.balance").value(ServiceTestConfiguration.ACCOUNT_BALANCE.doubleValue()))
.andExpect(jsonPath("$.lastlogin").value(DATE))
.andExpect(jsonPath("$.lastlogin").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.logincount").value(ServiceTestConfiguration.LOGIN_COUNT))
.andDo(print());
}
Expand Down
Expand Up @@ -36,7 +36,6 @@

public class HoldingControllerTest extends AbstractSecureControllerTest {
private static Integer PURCHASE_PRICE = 50000;
private static String PURCHASE_DATE = "2012-02-20";
private static Integer QUANTITY = 200;

@Test
Expand All @@ -45,7 +44,7 @@ public void getHoldingByIdJson() throws Exception {
.andExpect(content().mimeType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.holdingid").value(ServiceTestConfiguration.HOLDING_ID))
.andExpect(jsonPath("$.accountAccountid").value(ServiceTestConfiguration.ACCOUNT_ID))
.andExpect(jsonPath("$.purchasedate").value(PURCHASE_DATE))
.andExpect(jsonPath("$.purchasedate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.quote.symbol").value(ServiceTestConfiguration.SYMBOL))
.andExpect(jsonPath("$.purchaseprice").value(PURCHASE_PRICE))
.andExpect(jsonPath("$.quantity").value(QUANTITY))
Expand All @@ -70,7 +69,7 @@ public void getHoldingsByAccountIdJson() throws Exception {
.andExpect(content().mimeType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.results.[0].holdingid").value(ServiceTestConfiguration.HOLDING_ID))
.andExpect(jsonPath("$.results.[0].accountAccountid").value(ServiceTestConfiguration.ACCOUNT_ID))
.andExpect(jsonPath("$.results.[0].purchasedate").value(PURCHASE_DATE))
.andExpect(jsonPath("$.results.[0].purchasedate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.results.[0].quote.symbol").value(ServiceTestConfiguration.SYMBOL))
.andExpect(jsonPath("$.results.[0].purchaseprice").value(PURCHASE_PRICE))
.andExpect(jsonPath("$.results.[0].quantity").value(QUANTITY)).andDo(print());
Expand Down
Expand Up @@ -40,16 +40,15 @@


public class OrderControllerTest extends AbstractSecureControllerTest {
private static String PURCHASE_DATE = "2012-02-20";

@Test
public void getOrderByIdJson() throws Exception {
mockMvc.perform(get("/account/" + ServiceTestConfiguration.ACCOUNT_ID + "/order/999/").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().mimeType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.orderid").value(ServiceTestConfiguration.ORDER_ID))
.andExpect(jsonPath("$.completiondate").value(PURCHASE_DATE))
.andExpect(jsonPath("$.opendate").value(PURCHASE_DATE))
.andExpect(jsonPath("$.completiondate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.opendate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.orderfee").value(TradingServiceImpl.DEFAULT_ORDER_FEE.doubleValue()))
.andExpect(jsonPath("$.price").value(ServiceTestConfiguration.ORDER_PRICE.intValue()))
.andExpect(jsonPath("$.quantity").value(ServiceTestConfiguration.ORDER_QUANTITY.intValue()))
Expand All @@ -73,8 +72,8 @@ public void getOrders() throws Exception {
.andExpect(status().isOk())
.andExpect(content().mimeType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.results.[0].orderid").value(ServiceTestConfiguration.ORDER_ID))
.andExpect(jsonPath("$.results.[0].completiondate").value(PURCHASE_DATE))
.andExpect(jsonPath("$.results.[0].opendate").value(PURCHASE_DATE))
.andExpect(jsonPath("$.results.[0].completiondate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.results.[0].opendate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.results.[0].orderfee").value(TradingServiceImpl.DEFAULT_ORDER_FEE.doubleValue()))
.andExpect(jsonPath("$.results.[0].price").value(ServiceTestConfiguration.ORDER_PRICE.intValue()))
.andExpect(jsonPath("$.results.[0].quantity").value(ServiceTestConfiguration.ORDER_QUANTITY.intValue()))
Expand All @@ -99,8 +98,8 @@ public void getClosedOrders() throws Exception {
.andExpect(status().isOk())
.andExpect(content().mimeType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.results.[0].orderid").value(ServiceTestConfiguration.ORDER_ID))
.andExpect(jsonPath("$.results.[0].completiondate").value(PURCHASE_DATE))
.andExpect(jsonPath("$.results.[0].opendate").value(PURCHASE_DATE))
.andExpect(jsonPath("$.results.[0].completiondate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.results.[0].opendate").value(ServiceTestConfiguration.DATE))
.andExpect(jsonPath("$.results.[0].orderfee").value(TradingServiceImpl.DEFAULT_ORDER_FEE.doubleValue()))
.andExpect(jsonPath("$.results.[0].price").value(ServiceTestConfiguration.ORDER_PRICE.intValue()))
.andExpect(jsonPath("$.results.[0].quantity").value(ServiceTestConfiguration.ORDER_QUANTITY.intValue()))
Expand Down

0 comments on commit abe302a

Please sign in to comment.