Skip to content

Commit 7a7497c

Browse files
committed
feature/v1.0.5: bug fix
1 parent 40b649e commit 7a7497c

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/main/java/co/featbit/commons/model/AllFlagStates.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private <T> EvalDetail<T> getInternal(String flagKeyName, T defaultValue, Class<
8686
} else if (clzz == Double.class) {
8787
res = Double.parseDouble(variation);
8888
} else {
89-
res = Double.parseDouble(variation);
89+
res = Long.parseLong(variation);
9090
}
9191
}
9292
}

src/test/java/co/featbit/server/FBClientTest.java

+8-14
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,15 @@ void init() {
7171
cnPhoneNumber = new FBUser.Builder("18555358000").userName("test-user-5").build();
7272
frPhoneNumber = new FBUser.Builder("0603111111").userName("test-user-6").build();
7373
email = new FBUser.Builder("[email protected]").userName("test-user-7").build();
74-
fakeConfigBuilder = new FBConfig.Builder()
75-
.streamingURL(fakeUrl)
76-
.eventURL(fakeUrl);
74+
fakeConfigBuilder = new FBConfig.Builder().streamingURL(fakeUrl).eventURL(fakeUrl);
7775
initFuture = support.createNiceMock(Future.class);
7876
dataSynchronizer = support.createNiceMock(DataSynchronizer.class);
7977
insightProcessor = support.createNiceMock(InsightProcessor.class);
8078
dataStorage = support.createNiceMock(DataStorage.class);
8179
}
8280

8381
private FBClient createMockClient(FBConfig.Builder config) {
84-
config.dataSynchronizerFactory(mockDataSynchronizerFactory(dataSynchronizer))
85-
.insightProcessorFactory(mockInsightProcessorFactory(insightProcessor))
86-
.dataStorageFactory(mockDataStorageFactory(dataStorage));
82+
config.dataSynchronizerFactory(mockDataSynchronizerFactory(dataSynchronizer)).insightProcessorFactory(mockInsightProcessorFactory(insightProcessor)).dataStorageFactory(mockDataStorageFactory(dataStorage));
8783
return new FBClientImp(fakeEnvSecret, config.build());
8884
}
8985

@@ -187,7 +183,11 @@ void testAllLatestFlagsVariations() throws IOException {
187183
assertEquals(true, ed1.getVariation());
188184
assertEquals(REASON_TARGET_MATCH, ed1.getReason());
189185
EvalDetail<Integer> ed2 = states.getIntegerDetail("ff-test-number", 0);
186+
Long longValue = states.getLong("ff-test-number", 0L);
187+
Double doubleValue = states.getDouble("ff-test-number", 0D);
190188
assertEquals(1, ed2.getVariation());
189+
assertEquals(1L, longValue);
190+
assertEquals(1D, doubleValue);
191191
assertEquals(REASON_RULE_MATCH, ed2.getReason());
192192
EvalDetail<String> ed3 = states.getStringDetail("ff-test-string", "");
193193
assertEquals("others", ed3.getVariation());
@@ -283,10 +283,7 @@ void testConstructIllegalEnvSecret() throws IOException {
283283

284284
@Test
285285
void testConstructEmptyUrl() throws IOException {
286-
FBConfig errorConfig = new FBConfig.Builder()
287-
.streamingURL("")
288-
.eventURL("")
289-
.build();
286+
FBConfig errorConfig = new FBConfig.Builder().streamingURL("").eventURL("").build();
290287
try (FBClient client = new FBClientImp(fakeEnvSecret, errorConfig)) {
291288
fail("illegal argument exception");
292289
} catch (IllegalArgumentException e) {
@@ -296,10 +293,7 @@ void testConstructEmptyUrl() throws IOException {
296293

297294
@Test
298295
void testConstructIllegalUrl() throws IOException {
299-
FBConfig errorConfig = new FBConfig.Builder()
300-
.streamingURL("urn:isbn:0-294-56559-3")
301-
.eventURL("mailto:[email protected]")
302-
.build();
296+
FBConfig errorConfig = new FBConfig.Builder().streamingURL("urn:isbn:0-294-56559-3").eventURL("mailto:[email protected]").build();
303297
try (FBClient client = new FBClientImp(fakeEnvSecret, errorConfig)) {
304298
fail("illegal argument exception");
305299
} catch (IllegalArgumentException e) {

0 commit comments

Comments
 (0)