Skip to content

Commit

Permalink
[GH] [Navigation] Fix tests in NavDeepLinkTest
Browse files Browse the repository at this point in the history
There were tests that actually did not what was declared in assert.

## Testing

Test: ./gradlew connectedCheck

This is an imported pull request from androidx#210.

Resolves androidx#210
Github-Pr-Head-Sha: 642e2a2
GitOrigin-RevId: d3e202a
Change-Id: I5d5ce1a5a5e61f984bfb6022ca6c5dd261d3020e
  • Loading branch information
osipxd authored and copybara-github committed Jul 28, 2021
1 parent 597c5c5 commit afa68d0
Showing 1 changed file with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ class NavDeepLinkTest {
assertWithMessage("Args should not be null")
.that(matchArgs)
.isNotNull()
assertWithMessage("Args should contain the argument and it should be null")
.that(matchArgs?.getString("myarg"))
.isNull()
assertWithMessage("Args should not contain the argument")
.that(matchArgs?.containsKey("myarg"))
.isFalse()
}

// Ensure case when matching the exact argument query (i.e. param names in braces) is handled
Expand Down Expand Up @@ -374,9 +374,9 @@ class NavDeepLinkTest {
assertWithMessage("Args should not be null")
.that(matchArgs)
.isNotNull()
assertWithMessage("Args should contain the argument and it should be null")
.that(matchArgs?.getString("myarg"))
.isNull()
assertWithMessage("Args should not contain the argument")
.that(matchArgs?.containsKey("myarg"))
.isFalse()
}

@Test
Expand Down Expand Up @@ -451,9 +451,9 @@ class NavDeepLinkTest {
assertWithMessage("Args should contain the id")
.that(matchArgs?.getInt("id"))
.isEqualTo(id)
assertWithMessage("Args should contain optional")
.that(matchArgs?.getString("optional"))
.isNull()
assertWithMessage("Args should not contain optional")
.that(matchArgs?.containsKey("optional"))
.isFalse()
}

// Make sure we allow extra params that may not been part of the given deep link
Expand Down Expand Up @@ -541,9 +541,9 @@ class NavDeepLinkTest {
assertWithMessage("Args should not be null")
.that(matchArgs)
.isNotNull()
assertWithMessage("Args should contain the argument and it should be null")
.that(matchArgs?.getString("myarg"))
.isNull()
assertWithMessage("Args should not contain the argument")
.that(matchArgs?.containsKey("myarg"))
.isFalse()
}

@Test
Expand Down Expand Up @@ -579,9 +579,9 @@ class NavDeepLinkTest {
assertWithMessage("Args should not be null")
.that(matchArgs)
.isNotNull()
assertWithMessage("Args should contain the argument and it should be null")
.that(matchArgs?.getString("myarg"))
.isNull()
assertWithMessage("Args should not contain the argument")
.that(matchArgs?.containsKey("myarg"))
.isFalse()
}

@Test
Expand Down Expand Up @@ -632,9 +632,9 @@ class NavDeepLinkTest {
assertWithMessage("Args should not be null")
.that(matchArgs)
.isNotNull()
assertWithMessage("Args should contain the argument and it should be null")
.that(matchArgs?.getString("myarg"))
.isNull()
assertWithMessage("Args should not contain the argument")
.that(matchArgs?.containsKey("myarg"))
.isFalse()
}

@Test
Expand Down Expand Up @@ -745,12 +745,12 @@ class NavDeepLinkTest {
assertWithMessage("Args should not be null")
.that(matchArgs)
.isNotNull()
assertWithMessage("Args should contain the first name")
.that(matchArgs?.getString("first"))
.isNull()
assertWithMessage("Args should contain the last name")
.that(matchArgs?.getString("last"))
.isNull()
assertWithMessage("Args should not contain the first name")
.that(matchArgs?.containsKey("first"))
.isFalse()
assertWithMessage("Args should not contain the last name")
.that(matchArgs?.containsKey("last"))
.isFalse()
}

@Test
Expand Down Expand Up @@ -804,9 +804,9 @@ class NavDeepLinkTest {
assertWithMessage("Args should not be null")
.that(matchArgs)
.isNotNull()
assertWithMessage("Args should contain arg as null")
.that(matchArgs?.getString("myarg"))
.isNull()
assertWithMessage("Args should not contain the argument")
.that(matchArgs?.containsKey("myarg"))
.isFalse()
}

// Handle the case were the input is wild card and separator with no argument
Expand Down Expand Up @@ -918,9 +918,9 @@ class NavDeepLinkTest {
assertWithMessage("Args should not be null")
.that(matchArgs)
.isNotNull()
assertWithMessage("Args should contain the path as null")
.that(matchArgs?.getString("path"))
.isNull()
assertWithMessage("Args should not contain the path")
.that(matchArgs?.containsKey("path"))
.isFalse()
}

// Handle the case were the input could be entire path except for the argument
Expand Down

0 comments on commit afa68d0

Please sign in to comment.