-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a938d93
commit 86fad4f
Showing
3 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...u/bittrade/libs/steemj/plugins/apis/account/history/models/GetAccountHistoryArgsTest.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,55 @@ | ||
package eu.bittrade.libs.steemj.plugins.apis.account.history.models; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.junit.Assert.fail; | ||
|
||
import java.security.InvalidParameterException; | ||
|
||
import org.joou.UInteger; | ||
import org.joou.ULong; | ||
import org.junit.Test; | ||
|
||
import eu.bittrade.libs.steemj.protocol.AccountName; | ||
|
||
/** | ||
* This class contains all test connected to the | ||
* {@link eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetAccountHistoryArgs | ||
* GetAccountHistoryArgs} object. | ||
* | ||
* @author <a href="http://steemit.com/@dez1337">dez1337</a> | ||
*/ | ||
public class GetAccountHistoryArgsTest { | ||
/** | ||
* Test if the {@link GetAccountHistoryArgs} fields are validated correctly. | ||
*/ | ||
@Test | ||
public void testFieldValidation() { | ||
AccountName accountName = new AccountName("dez1337"); | ||
ULong start = ULong.valueOf(20); | ||
UInteger limit = UInteger.valueOf(10); | ||
|
||
GetAccountHistoryArgs getAccountHistoryArgs = new GetAccountHistoryArgs(accountName, start, limit); | ||
|
||
assertThat(getAccountHistoryArgs.getAccount(), equalTo(accountName)); | ||
assertThat(getAccountHistoryArgs.getStart(), equalTo(start)); | ||
assertThat(getAccountHistoryArgs.getLimit(), equalTo(limit)); | ||
|
||
// Check if default values are applied correctly if <code>null</code> | ||
// values are provided: | ||
getAccountHistoryArgs.setLimit(null); | ||
getAccountHistoryArgs.setStart(null); | ||
|
||
assertThat(getAccountHistoryArgs.getStart(), equalTo(ULong.valueOf(-1))); | ||
assertThat(getAccountHistoryArgs.getLimit(), equalTo(UInteger.valueOf(1000))); | ||
|
||
// Verify that an exception is thrown if required fields are not | ||
// provided: | ||
try { | ||
getAccountHistoryArgs.setAccount(null); | ||
fail(); | ||
} catch (InvalidParameterException e) { | ||
// Expected. | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...va/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetOpsInBlockArgsTest.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,41 @@ | ||
package eu.bittrade.libs.steemj.plugins.apis.account.history.models; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.junit.Assert.fail; | ||
|
||
import java.security.InvalidParameterException; | ||
|
||
import org.joou.UInteger; | ||
import org.junit.Test; | ||
|
||
/** | ||
* This class contains all test connected to the | ||
* {@link eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetOpsInBlockArgs | ||
* GetOpsInBlockArgs} object. | ||
* | ||
* @author <a href="http://steemit.com/@dez1337">dez1337</a> | ||
*/ | ||
public class GetOpsInBlockArgsTest { | ||
/** | ||
* Test if the {@link GetOpsInBlockArgs} fields are validated correctly. | ||
*/ | ||
@Test | ||
public void testFieldValidation() { | ||
UInteger blockNum = UInteger.valueOf(1345461); | ||
|
||
GetOpsInBlockArgs getOpsInBlockArgs = new GetOpsInBlockArgs(blockNum, false); | ||
|
||
assertThat(getOpsInBlockArgs.getBlockNum(), equalTo(blockNum)); | ||
assertThat(getOpsInBlockArgs.getOnlyVirtual(), equalTo(false)); | ||
|
||
// Verify that an exception is thrown if required fields are not | ||
// provided: | ||
try { | ||
getOpsInBlockArgs.setBlockNum(null); | ||
fail(); | ||
} catch (InvalidParameterException e) { | ||
// Expected. | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...a/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetTransactionArgsTest.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,41 @@ | ||
package eu.bittrade.libs.steemj.plugins.apis.account.history.models; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.junit.Assert.fail; | ||
|
||
import java.security.InvalidParameterException; | ||
|
||
import org.junit.Test; | ||
|
||
import eu.bittrade.libs.steemj.protocol.TransactionId; | ||
|
||
/** | ||
* This class contains all test connected to the | ||
* {@link eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetTransactionArgs | ||
* GetTransactionArgs} object. | ||
* | ||
* @author <a href="http://steemit.com/@dez1337">dez1337</a> | ||
*/ | ||
public class GetTransactionArgsTest { | ||
/** | ||
* Test if the {@link GetTransactionArgs} fields are validated correctly. | ||
*/ | ||
@Test | ||
public void testFieldValidation() { | ||
TransactionId transactionId = new TransactionId("bd8069e6544f658da560b72e93b605dfe2cb0aaf"); | ||
|
||
GetTransactionArgs getTransactionArgs = new GetTransactionArgs(transactionId); | ||
|
||
assertThat(getTransactionArgs.getId(), equalTo(transactionId)); | ||
|
||
// Verify that an exception is thrown if required fields are not | ||
// provided: | ||
try { | ||
getTransactionArgs.setId(null); | ||
fail(); | ||
} catch (InvalidParameterException e) { | ||
// Expected. | ||
} | ||
} | ||
} |