-
Notifications
You must be signed in to change notification settings - Fork 86
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
Added tests for the TableMetaDataEntries class #318
base: upgrade-jdk11
Are you sure you want to change the base?
Conversation
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.
good start
public class TableMetaDataEntriesTest { | ||
|
||
// | ||
TableMetaDataEntries testMetaDataEntries; |
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.
Why are TableMetaDataEntries are not private? Do you expect other test classes to access them from a different class?
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.
No sir. I have made another commit reflecting the required changes.
private final String TABLE_ID = "testTable"; | ||
private final String REV_ID = "revId"; | ||
KeyValueStoreEntry entry1 = new KeyValueStoreEntry(); | ||
KeyValueStoreEntry entry2 = new KeyValueStoreEntry(); |
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.
Why are entry1 and entry2 not private? Do you expect other test classes to access them from a different class?
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.
No sir, new changes have limited access to the test class.
entry1.aspect = "aspect1"; | ||
entry1.key = "key1"; | ||
entry1.type = "number"; | ||
entry1.value = "value1"; |
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 string constants so you can then reuse string constants in assert statements
} | ||
|
||
|
||
} |
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.
add a new line to the end of the file
…anges: made testMetaDataEntries private, ENTRY_1,and ENTRY_2 private and final
…ed in tests. Refrectored testAddEntry to check for data integrity.
# Conflicts: # androidlibrary_lib/src/androidTest/java/org/opendatakit/database/data/TableMetaDataEntriesTest.java
This pull request addresses odk-x/tool-suite-X#522 by adding tests for the TableMetaDataEntries and KeyValueStoreEntry classes under data.
Added tests for the TableMetaDataEntries class
testDataBaseInitialization
Verifies that the database was created and is empty upon creation.
testAddEntry
Verifies that an entry made to the database is successful.
testDescribeContents
Tests the content description accuracy.
testWriteToParcel
Tests that the data written to a parcel is successful and reads the data to make sure data integrity is maintained.
testEntryOrderPreservation
Verifies that entries are stored in the order in which they were added.
Added tests for the KeyValueStoreEntry class
testKeyValueStoreEntryInitialization
Tests that a KeyValueStoreEntry object is initialized correctly and it is empty on creation.
testToString
Tests that the content of a KeyValueStoreEntry object is correctly converted to a string.
testHashCodeConsistency
Validates hash code consistency of a KeyValueStoreEntry object and the same instance of that object stored in a parcel.
testHashCodeDifference
Validates hash code difference of two KeyValueStoreEntry objects.
testEqualsNull
Validates of inequality of a KeyValueStoreEntry against a null KeyValueStoreEntry object.
testEqualsSameObject
Test of equality of a KeyValueStoreEntry against itself.
testEqualsDifferentObject
Test for inequality of a KeyValueStoreEntry object against another KeyValueStoreEntry object.
testEqualsTypeMismatch
Test for inequality of a KeyValueStoreEntry object against an object of a different type.
testCompareToPartition
Verifies the comparison and sorting of two KeyValueStoreEntry objects based on their partition attributes.
testCompareToAspect
Verifies the comparison and sorting of two KeyValueStoreEntry objects based on their aspect attributes.
testCompareToKey
Verifies the comparison and sorting of two KeyValueStoreEntry objects based on their key attributes.
testToCompareEquality
Verifies comparison of equality of two KeyValueStoryEntry objects.
testDescribeContents
Tests the content description accuracy.
testWriteToParcel
Verifies that the data written to a parcel is successful and reads the data to ensure data integrity is maintained.