-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(config): optimize log for config without Blackhole account #6356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,29 @@ | ||
| package org.tron.core.db; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
| import static org.mockito.Mockito.mock; | ||
|
|
||
| import com.google.protobuf.ByteString; | ||
| import com.typesafe.config.Config; | ||
| import java.lang.reflect.Field; | ||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import javax.annotation.Resource; | ||
| import org.junit.Assert; | ||
| import org.junit.Before; | ||
| import org.junit.Test; | ||
| import org.mockito.Mockito; | ||
| import org.tron.common.BaseTest; | ||
| import org.tron.common.utils.ByteArray; | ||
| import org.tron.core.Constant; | ||
| import org.tron.core.capsule.AccountCapsule; | ||
| import org.tron.core.config.args.Args; | ||
| import org.tron.core.db2.ISession; | ||
| import org.tron.core.exception.TronError; | ||
| import org.tron.core.net.peer.PeerManager; | ||
| import org.tron.core.store.AccountStore; | ||
| import org.tron.core.store.AssetIssueStore; | ||
| import org.tron.core.store.DynamicPropertiesStore; | ||
|
|
@@ -61,6 +70,21 @@ public void init() { | |
| init = true; | ||
| } | ||
|
|
||
| @Test | ||
| public void setAccountTest() throws Exception { | ||
| Field field = AccountStore.class.getDeclaredField("assertsAddress"); | ||
| field.setAccessible(true); | ||
| field.set(AccountStore.class, new HashMap<>()); | ||
| Config config = mock(Config.class); | ||
| Mockito.when(config.getObjectList("genesis.block.assets")).thenReturn(new ArrayList<>()); | ||
| try { | ||
| AccountStore.setAccount(config); | ||
| Assert.fail(); | ||
| } catch (Throwable e) { | ||
| Assert.assertTrue(e instanceof TronError); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is enough to judge the exception type, which is mainly functional testing rather than specific log information comparison. |
||
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void get() { | ||
| //test get and has Method | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ACCOUNT_BLACKHOLE instead of Blackhole?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this process occurs when the genesis block is being initialized