Showing
1 changed file
with
18 additions
and
17 deletions
@@ -35,6 +35,7 @@ import java.io.IOException; | @@ -35,6 +35,7 @@ import java.io.IOException; | ||
35 | import java.math.BigDecimal; | 35 | import java.math.BigDecimal; |
36 | import java.util.ArrayList; | 36 | import java.util.ArrayList; |
37 | import java.util.List; | 37 | import java.util.List; |
38 | +import java.util.concurrent.TimeUnit; | ||
38 | 39 | ||
39 | 40 | ||
40 | public class SellerEnterTypeChangeEventTest extends BaseWebTest { | 41 | public class SellerEnterTypeChangeEventTest extends BaseWebTest { |
@@ -63,31 +64,25 @@ public class SellerEnterTypeChangeEventTest extends BaseWebTest { | @@ -63,31 +64,25 @@ public class SellerEnterTypeChangeEventTest extends BaseWebTest { | ||
63 | } | 64 | } |
64 | 65 | ||
65 | @Test | 66 | @Test |
66 | - public void test_stats_event() { | 67 | + public void test_stats_event() throws Exception{ |
67 | BuyerOrder buyerOrder = new BuyerOrder(); | 68 | BuyerOrder buyerOrder = new BuyerOrder(); |
68 | buyerOrder.setUid(500031424); | 69 | buyerOrder.setUid(500031424); |
69 | buyerOrder.setOrderCode(9939757498185L); | 70 | buyerOrder.setOrderCode(9939757498185L); |
70 | buyerOrder.setSellerUid(500031424); | 71 | buyerOrder.setSellerUid(500031424); |
71 | orderChangeListenerContainer.fireAsyncEvent(new BuyerOrderChangeEvent(buyerOrder, BuyerOrderChangeEvent.BizCase.APPRAISE_SUCCESS, OrderStatus.DONE)); | 72 | orderChangeListenerContainer.fireAsyncEvent(new BuyerOrderChangeEvent(buyerOrder, BuyerOrderChangeEvent.BizCase.APPRAISE_SUCCESS, OrderStatus.DONE)); |
73 | + TimeUnit.SECONDS.sleep(10); | ||
72 | } | 74 | } |
73 | 75 | ||
74 | @Test | 76 | @Test |
75 | - public void test_enter_event() { | 77 | + public void test_enter_event() throws Exception{ |
76 | EventBusPublisher.publishEvent(SellerEnterTypeChangeEvent.builder().sellerUid(500031116).eventType(EnterQuitEnum.ENTER).build()); | 78 | EventBusPublisher.publishEvent(SellerEnterTypeChangeEvent.builder().sellerUid(500031116).eventType(EnterQuitEnum.ENTER).build()); |
79 | + TimeUnit.SECONDS.sleep(10); | ||
77 | } | 80 | } |
78 | 81 | ||
79 | @Test | 82 | @Test |
80 | - public void test_quit_event() { | ||
81 | - EventBusPublisher.publishEvent(SellerEnterTypeChangeEvent.builder().sellerUid(500031424).eventType(EnterQuitEnum.QUIT).build()); | ||
82 | - } | ||
83 | - | ||
84 | - | ||
85 | - @Test | ||
86 | - public void platformServiceFeeDetail() { | ||
87 | - SellerPlatformServiceFeeResp sellerPlatformServiceFeeResp = sellerService.platformServiceFeeDetail(500031424); | ||
88 | - System.out.println(sellerPlatformServiceFeeResp); | ||
89 | - Assert.assertNotNull(sellerPlatformServiceFeeResp); | ||
90 | - Assert.assertEquals(sellerPlatformServiceFeeResp.getCurrentRate(), "5.0%"); | 83 | + public void test_quit_event() throws Exception{ |
84 | + EventBusPublisher.publishEvent(SellerEnterTypeChangeEvent.builder().sellerUid(500031116).eventType(EnterQuitEnum.QUIT).build()); | ||
85 | + TimeUnit.SECONDS.sleep(10); | ||
91 | } | 86 | } |
92 | 87 | ||
93 | @Test | 88 | @Test |
@@ -108,7 +103,8 @@ public class SellerEnterTypeChangeEventTest extends BaseWebTest { | @@ -108,7 +103,8 @@ public class SellerEnterTypeChangeEventTest extends BaseWebTest { | ||
108 | Mockito.when(sellerService.getEntrySellerType(500031424)).thenReturn(EntrySellerType.SUPER_ENTRY); | 103 | Mockito.when(sellerService.getEntrySellerType(500031424)).thenReturn(EntrySellerType.SUPER_ENTRY); |
109 | 104 | ||
110 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); | 105 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); |
111 | - Assert.assertEquals(feeRate.toPlainString(),"0.045"); | 106 | + Assert.assertTrue(feeRate != null); |
107 | + Assert.assertEquals(feeRate.toPlainString(), "0.045"); | ||
112 | } | 108 | } |
113 | 109 | ||
114 | @Test | 110 | @Test |
@@ -125,7 +121,7 @@ public class SellerEnterTypeChangeEventTest extends BaseWebTest { | @@ -125,7 +121,7 @@ public class SellerEnterTypeChangeEventTest extends BaseWebTest { | ||
125 | 121 | ||
126 | Mockito.when(statsConfigurationManager.getStatsConfig(Mockito.any(SellerOrderStatsEntry.class))).thenReturn(SellerOrderStatsConfiguration.emptyConfiguration); | 122 | Mockito.when(statsConfigurationManager.getStatsConfig(Mockito.any(SellerOrderStatsEntry.class))).thenReturn(SellerOrderStatsConfiguration.emptyConfiguration); |
127 | 123 | ||
128 | - Mockito.when(statsConfigurationManager.getStatsProcessor(SellerOrderStatsConfiguration.emptyConfiguration.getStatsProcessorName())).thenReturn(new EmptyStatsProcessor(){ | 124 | + Mockito.when(statsConfigurationManager.getStatsProcessor(SellerOrderStatsConfiguration.emptyConfiguration.getStatsProcessorName())).thenReturn(new EmptyStatsProcessor() { |
129 | @Override | 125 | @Override |
130 | public SellerOrderStatsResult getResult(SellerOrderStatsEntry entry, SellerOrderStatsConfiguration configuration) { | 126 | public SellerOrderStatsResult getResult(SellerOrderStatsEntry entry, SellerOrderStatsConfiguration configuration) { |
131 | SellerOrderStatsResult statsResult = new SellerOrderStatsResult(); | 127 | SellerOrderStatsResult statsResult = new SellerOrderStatsResult(); |
@@ -140,13 +136,18 @@ public class SellerEnterTypeChangeEventTest extends BaseWebTest { | @@ -140,13 +136,18 @@ public class SellerEnterTypeChangeEventTest extends BaseWebTest { | ||
140 | Mockito.when(sellerService.getEntrySellerType(500031424)).thenReturn(EntrySellerType.SUPER_ENTRY); | 136 | Mockito.when(sellerService.getEntrySellerType(500031424)).thenReturn(EntrySellerType.SUPER_ENTRY); |
141 | 137 | ||
142 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); | 138 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); |
143 | - Assert.assertEquals(feeRate.toPlainString(),"0.044"); | 139 | + |
140 | + Assert.assertTrue(feeRate != null); | ||
141 | + Assert.assertEquals(feeRate.toPlainString(), "0.044"); | ||
144 | } | 142 | } |
145 | 143 | ||
146 | @Test | 144 | @Test |
147 | public void getPlatformServiceFeeRate_withoutRules() { | 145 | public void getPlatformServiceFeeRate_withoutRules() { |
148 | Mockito.when(sellerServiceFeeRuleCacheService.getRuleDefinitions()).thenReturn(Lists.newArrayList()); | 146 | Mockito.when(sellerServiceFeeRuleCacheService.getRuleDefinitions()).thenReturn(Lists.newArrayList()); |
147 | + Mockito.when(statsConfigurationManager.getStatsConfig(Mockito.any(SellerOrderStatsEntry.class))).thenReturn(SellerOrderStatsConfiguration.emptyConfiguration); | ||
148 | + Mockito.when(statsConfigurationManager.getStatsProcessor(SellerOrderStatsConfiguration.emptyConfiguration.getStatsProcessorName())).thenReturn(new EmptyStatsProcessor()); | ||
149 | + Mockito.when(sellerService.getEntrySellerType(500031424)).thenReturn(EntrySellerType.SUPER_ENTRY); | ||
149 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); | 150 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); |
150 | - Assert.assertEquals(feeRate,null); | 151 | + Assert.assertTrue(feeRate == null); |
151 | } | 152 | } |
152 | } | 153 | } |
-
Please register or login to post a comment