-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Markus KARG <[email protected]>
- Loading branch information
Showing
1 changed file
with
131 additions
and
0 deletions.
There are no files selected for viewing
131 changes: 131 additions & 0 deletions
131
media/json-binding/src/test/JsonBindingProviderTest.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,131 @@ | ||
package org.glassfish.jersey.jsonb.internal; | ||
|
||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON_PATCH_JSON_TYPE; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.lang.annotation.Annotation; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import javax.ws.rs.core.MultivaluedMap; | ||
import javax.ws.rs.core.NoContentException; | ||
import javax.ws.rs.ext.MessageBodyReader; | ||
|
||
import org.junit.Test; | ||
|
||
public final class JsonBindingProviderTest { | ||
|
||
@Test(expected = NoContentException.class) | ||
public final void shouldThrowNoContentException() throws IOException { | ||
// given | ||
final MessageBodyReader<Foo> mbr = new JsonBindingProvider<>(); | ||
|
||
// when | ||
mbr.readFrom(Foo.class, Foo.class, new Annotation[0], APPLICATION_JSON_PATCH_JSON_TYPE, | ||
new EmptyMultivaluedMap<String, String>(), new ByteArrayInputStream(new byte[0])); | ||
|
||
// then | ||
// should throw NoContentException | ||
} | ||
|
||
private static final class Foo { | ||
// no members | ||
} | ||
|
||
private static final class EmptyMultivaluedMap<K, V> implements MultivaluedMap<K, V> { | ||
|
||
@Override | ||
public final int size() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public final boolean isEmpty() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public final boolean containsKey(final Object key) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public final boolean containsValue(final Object value) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public final List<V> get(final Object key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public final List<V> put(final K key, final List<V> value) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public final List<V> remove(final Object key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public final void putAll(final Map<? extends K, ? extends List<V>> m) { | ||
} | ||
|
||
@Override | ||
public final void clear() { | ||
} | ||
|
||
@Override | ||
public final Set<K> keySet() { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public final Collection<List<V>> values() { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public final Set<Entry<K, List<V>>> entrySet() { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public final void putSingle(final K key, final V value) { | ||
} | ||
|
||
@Override | ||
public final void add(final K key, final V value) { | ||
} | ||
|
||
@Override | ||
public final V getFirst(final K key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public final void addAll(final K key, final V... newValues) { | ||
} | ||
|
||
@Override | ||
public final void addAll(final K key, final List<V> valueList) { | ||
} | ||
|
||
@Override | ||
public final void addFirst(final K key, final V value) { | ||
} | ||
|
||
@Override | ||
public final boolean equalsIgnoreValueOrder(final MultivaluedMap<K, V> otherMap) { | ||
return false; | ||
} | ||
|
||
} | ||
|
||
} |