-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from trivago/test-coverage
Test coverage increase
- Loading branch information
Showing
8 changed files
with
111 additions
and
7 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.trivago.rta.json.pojo; | ||
|
||
import com.openpojo.reflection.PojoClass; | ||
import com.openpojo.reflection.filters.FilterPackageInfo; | ||
import com.openpojo.reflection.impl.PojoClassFactory; | ||
import com.openpojo.validation.Validator; | ||
import com.openpojo.validation.ValidatorBuilder; | ||
import com.openpojo.validation.affirm.Affirm; | ||
import com.openpojo.validation.test.impl.GetterTester; | ||
import com.openpojo.validation.test.impl.SetterTester; | ||
import org.junit.Test; | ||
|
||
import java.util.List; | ||
|
||
public class PojoTest { | ||
private static final int EXPECTED_CLASS_COUNT = 12; | ||
private static final String POJO_PACKAGE = "com.trivago.rta.json.pojo"; | ||
|
||
@Test | ||
public void ensureExpectedPojoCount() { | ||
List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE, | ||
new FilterPackageInfo()); | ||
Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size()); | ||
} | ||
|
||
@Test | ||
public void testPojoStructureAndBehavior() { | ||
Validator validator = ValidatorBuilder.create() | ||
.with(new SetterTester()) | ||
.with(new GetterTester()) | ||
.build(); | ||
|
||
validator.validate(POJO_PACKAGE, new FilterPackageInfo()); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/test/java/com/trivago/rta/rendering/pages/pojos/CustomParameterTest.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,29 @@ | ||
package com.trivago.rta.rendering.pages.pojos; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.hamcrest.core.Is.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
|
||
public class CustomParameterTest { | ||
|
||
@Test | ||
public void isValidUrlTest() { | ||
CustomParameter customParameter = new CustomParameter("test", "http://www.someurl.de"); | ||
assertThat(customParameter.isUrl(), is(true)); | ||
} | ||
|
||
@Test | ||
public void isInvalidUrlTest() { | ||
CustomParameter customParameter = new CustomParameter("test", "test"); | ||
assertThat(customParameter.isUrl(), is(false)); | ||
} | ||
|
||
@Test | ||
public void getKeyValueTest() { | ||
CustomParameter customParameter = new CustomParameter("key", "value"); | ||
assertThat(customParameter.getKey(), is("key")); | ||
assertThat(customParameter.getValue(), is("value")); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/test/java/com/trivago/rta/rendering/pages/pojos/PojoTest.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,35 @@ | ||
package com.trivago.rta.rendering.pages.pojos; | ||
|
||
import com.openpojo.reflection.PojoClass; | ||
import com.openpojo.reflection.filters.FilterPackageInfo; | ||
import com.openpojo.reflection.impl.PojoClassFactory; | ||
import com.openpojo.validation.Validator; | ||
import com.openpojo.validation.ValidatorBuilder; | ||
import com.openpojo.validation.affirm.Affirm; | ||
import com.openpojo.validation.test.impl.GetterTester; | ||
import com.openpojo.validation.test.impl.SetterTester; | ||
import org.junit.Test; | ||
|
||
import java.util.List; | ||
|
||
public class PojoTest { | ||
private static final int EXPECTED_CLASS_COUNT = 6; | ||
private static final String POJO_PACKAGE = "com.trivago.rta.rendering.pages.pojos"; | ||
|
||
@Test | ||
public void ensureExpectedPojoCount() { | ||
List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE, | ||
new FilterPackageInfo()); | ||
Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size()); | ||
} | ||
|
||
@Test | ||
public void testPojoStructureAndBehavior() { | ||
Validator validator = ValidatorBuilder.create() | ||
.with(new SetterTester()) | ||
.with(new GetterTester()) | ||
.build(); | ||
|
||
validator.validate(POJO_PACKAGE, new FilterPackageInfo()); | ||
} | ||
} |