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
1 parent
b3aa0a8
commit 16720cc
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/test/groovy/net/fortuna/ical4j/util/DefaultEncoderFactoryTest.groovy
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,40 @@ | ||
package net.fortuna.ical4j.util | ||
|
||
import net.fortuna.ical4j.model.parameter.Encoding | ||
import org.apache.commons.codec.BinaryEncoder | ||
import org.apache.commons.codec.StringEncoder | ||
import spock.lang.Specification | ||
|
||
class DefaultEncoderFactoryTest extends Specification { | ||
|
||
DefaultEncoderFactory factory = [] | ||
|
||
def "CreateBinaryEncoder"() { | ||
expect: 'a binary encoder' | ||
def encoder = factory.createBinaryEncoder(encoding) | ||
encoder instanceof BinaryEncoder | ||
|
||
where: | ||
encoding << [Encoding.BASE64, Encoding.QUOTED_PRINTABLE] | ||
} | ||
|
||
def "CreateStringEncoder"() { | ||
expect: 'a string encoder' | ||
def encoder = factory.createStringEncoder(encoding) | ||
encoder instanceof StringEncoder | ||
|
||
where: | ||
encoding << [Encoding.QUOTED_PRINTABLE] | ||
} | ||
|
||
def "assert invalid encoding"() { | ||
given: 'an invalid string encoding' | ||
def encoding = Encoding.BASE64 | ||
|
||
when: 'attempt to create encoder' | ||
factory.createStringEncoder(encoding) | ||
|
||
then: 'invalid encoding exception' | ||
thrown(UnsupportedEncodingException) | ||
} | ||
} |
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