-
Notifications
You must be signed in to change notification settings - Fork 0
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
pixelstuermer
committed
Oct 6, 2017
1 parent
23edc6d
commit 4199e7d
Showing
4 changed files
with
45 additions
and
8 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
37 changes: 37 additions & 0 deletions
37
src/test/java/com/github/pixelstuermer/password4me/controllers/ParameterControllerTest.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,37 @@ | ||
package com.github.pixelstuermer.password4me.controllers; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
import com.github.pixelstuermer.password4me.models.PasswordMap; | ||
import com.github.pixelstuermer.password4me.models.ValidationInfo; | ||
import com.github.pixelstuermer.password4me.utils.PasswordValidator; | ||
|
||
@RunWith( MockitoJUnitRunner.class ) | ||
public class ParameterControllerTest { | ||
|
||
@InjectMocks | ||
PwGenParametersController paramController; | ||
|
||
@Test | ||
public void generateAllCharsPasswordTest() { | ||
// mock controller and data | ||
PasswordMap pwMap = paramController.generatePwWithHttpHeaderParams( true, true, true, true, 42 ).getBody(); | ||
|
||
// extract generated password components | ||
ValidationInfo validation = PasswordValidator | ||
.validatePassword( pwMap.getPasswords().get( "password" ).toString() ); | ||
|
||
// test password components | ||
assertTrue( validation.isHasCapsChars() == true ); | ||
assertTrue( validation.isHasNumberChars() == true ); | ||
assertTrue( validation.isHasSmallChars() == true ); | ||
assertTrue( validation.isHasSpecialChars() == true ); | ||
assertTrue( validation.getLength() == 42 ); | ||
} | ||
|
||
} |
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