Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pdolezal committed Jun 5, 2016
1 parent 58069c5 commit f4b3fab
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/test/java/net/yetamine/sova/servlet/MockObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* A test object for adapting and yet useful for equality and identity tests.
*/
public final class MockObject {
final class MockObject {

/** Value of the object. */
private final Object value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@
*/
public final class TestServletContextSymbol {

// Testing values
/** Value to be present under the key {@code "integer"}. */
private static final Integer INTEGER_VALUE = Integer.valueOf(1024);
/** Value to be present under the key {@code "string"}. */
private static final String STRING_VALUE = "hello";

/**
* Testing attribute source with both {@link #INTEGER_VALUE} and
* {@link #STRING_VALUE}.
*/
private static final ServletContext DATA;
static {
DATA = new MockServletContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@
*/
public final class TestServletRequestSymbol {

// Testing values
/** Value to be present under the key {@code "integer"}. */
private static final Integer INTEGER_VALUE = Integer.valueOf(1024);
/** Value to be present under the key {@code "string"}. */
private static final String STRING_VALUE = "hello";

/**
* Testing attribute source with both {@link #INTEGER_VALUE} and
* {@link #STRING_VALUE}.
*/
private static final ServletRequest DATA;
static {
DATA = new MockServletRequest();
Expand Down
10 changes: 9 additions & 1 deletion src/test/java/net/yetamine/sova/servlet/TestServletSymbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@
*/
public final class TestServletSymbol {

// Testing values
/** Value to be present under the key {@code "integer"}. */
private static final Integer INTEGER_VALUE = Integer.valueOf(1024);
/** Value to be present under the key {@code "string"}. */
private static final String STRING_VALUE = "hello";
/** Value to be present under the key {@code "mock"}. */
private static final MockObject MOCK_VALUE = new MockObject("mock");

/**
* Testing attribute source with {@link #INTEGER_VALUE} and
* {@link #STRING_VALUE} as request attributes and {@link #MOCK_VALUE} as a
* context attribute.
*/
private static final ServletRequest DATA;
static {
final ServletContext context = new MockServletContext();
Expand Down Expand Up @@ -117,6 +124,7 @@ public void testYield() {
Assert.assertEquals(r1.fallback().get(), i);

final AdaptationResult<Integer> r2 = new ServletSymbol<>("string", p).yield(DATA);
Assert.assertEquals(r2.argument(), STRING_VALUE);
Assert.assertNull(r2.get());
Assert.assertEquals(r2.fallback().get(), i);

Expand Down

0 comments on commit f4b3fab

Please sign in to comment.