-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4035 from stejbac/speed-up-dao-state-monitor-view…
…-load Speed up DAO state monitor view load
- Loading branch information
Showing
6 changed files
with
115 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
desktop/src/test/java/bisq/desktop/main/dao/monitor/daostate/DaoStateBlockListItemTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* This file is part of Bisq. | ||
* | ||
* Bisq is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* Bisq is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package bisq.desktop.main.dao.monitor.daostate; | ||
|
||
import bisq.core.dao.monitoring.model.DaoStateBlock; | ||
import bisq.core.dao.monitoring.model.DaoStateHash; | ||
import bisq.core.locale.Res; | ||
|
||
import java.util.Locale; | ||
import java.util.function.IntSupplier; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotEquals; | ||
|
||
public class DaoStateBlockListItemTest { | ||
|
||
@Before | ||
public void setup() { | ||
Locale.setDefault(new Locale("en", "US")); | ||
Res.setBaseCurrencyCode("BTC"); | ||
Res.setBaseCurrencyName("Bitcoin"); | ||
} | ||
|
||
@Test | ||
public void testEqualsAndHashCode() { | ||
var block = new DaoStateBlock(new DaoStateHash(0, new byte[0], new byte[0])); | ||
var item1 = new DaoStateBlockListItem(block, newSupplier(1)); | ||
var item2 = new DaoStateBlockListItem(block, newSupplier(2)); | ||
var item3 = new DaoStateBlockListItem(block, newSupplier(1)); | ||
assertNotEquals(item1, item2); | ||
assertNotEquals(item2, item3); | ||
assertEquals(item1, item3); | ||
assertEquals(item1.hashCode(), item3.hashCode()); | ||
} | ||
|
||
private IntSupplier newSupplier(int i) { | ||
//noinspection Convert2Lambda | ||
return new IntSupplier() { | ||
@Override | ||
public int getAsInt() { | ||
return i; | ||
} | ||
}; | ||
} | ||
} |