Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Validating ApplicationName parameters. Added unit tests for parameter…
… validation.
- Loading branch information
1 parent
b88a000
commit 14329d4a4e0408ccfd0c5e0e50f1cd07ece1cfca
Showing
6 changed files
with
96 additions
and
12 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
@@ -0,0 +1,44 @@ | ||
package io.mifos.provisioner.api.v1.domain; | ||
|
||
import io.mifos.core.test.domain.ValidationTest; | ||
import io.mifos.core.test.domain.ValidationTestCase; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
/** | ||
* @author Myrle Krantz | ||
*/ | ||
public class ApplicationTest extends ValidationTest<Application> { | ||
|
||
public ApplicationTest(ValidationTestCase<Application> testCase) { | ||
super(testCase); | ||
} | ||
|
||
@Override | ||
protected Application createValidTestSubject() { | ||
final Application ret = new Application(); | ||
ret.setName("bebop-v3"); | ||
ret.setHomepage("http://xyz.bebop:2021/v1"); | ||
ret.setDescription("bebop manager"); | ||
ret.setVendor("fineract"); | ||
return ret; | ||
} | ||
|
||
@Parameterized.Parameters | ||
public static Collection testCases() { | ||
final Collection<ValidationTestCase> ret = new ArrayList<>(); | ||
ret.add(new ValidationTestCase<Application>("basicCase") | ||
.adjustment(x -> {}) | ||
.valid(true)); | ||
ret.add(new ValidationTestCase<Application>("invalidApplicationName") | ||
.adjustment(x -> x.setName("bebop-dowop")) | ||
.valid(false)); | ||
ret.add(new ValidationTestCase<Application>("nullApplicationName") | ||
.adjustment(x -> x.setName(null)) | ||
.valid(false)); | ||
return ret; | ||
} | ||
|
||
} |
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
@@ -0,0 +1,41 @@ | ||
package io.mifos.provisioner.api.v1.domain; | ||
|
||
import io.mifos.core.test.domain.ValidationTest; | ||
import io.mifos.core.test.domain.ValidationTestCase; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
/** | ||
* @author Myrle Krantz | ||
*/ | ||
public class AssignedApplicationTest extends ValidationTest<AssignedApplication> { | ||
|
||
public AssignedApplicationTest(ValidationTestCase<AssignedApplication> testCase) { | ||
super(testCase); | ||
} | ||
|
||
@Override | ||
protected AssignedApplication createValidTestSubject() { | ||
final AssignedApplication ret = new AssignedApplication(); | ||
ret.setName("bebop-v3"); | ||
return ret; | ||
} | ||
|
||
@Parameterized.Parameters | ||
public static Collection testCases() { | ||
final Collection<ValidationTestCase> ret = new ArrayList<>(); | ||
ret.add(new ValidationTestCase<AssignedApplication>("basicCase") | ||
.adjustment(x -> {}) | ||
.valid(true)); | ||
ret.add(new ValidationTestCase<AssignedApplication>("invalidApplicationName") | ||
.adjustment(x -> x.setName("bebop-dowop")) | ||
.valid(false)); | ||
ret.add(new ValidationTestCase<AssignedApplication>("nullApplicationName") | ||
.adjustment(x -> x.setName(null)) | ||
.valid(false)); | ||
return ret; | ||
} | ||
|
||
} |
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