### Question:
SyncDecoder extends ActiveSyncDecoder { @VisibleForTesting SyncCollection getCollection(Element collection) { PIMDataType dataType = PIMDataType.fromSpecificationValue(uniqueStringFieldValue(collection, SyncRequestFields.DATA_CLASS)); return SyncCollection.builder() .dataType(dataType) .syncKey(syncKey(uniqueStringFieldValue(collection, SyncRequestFields.SYNC_KEY))) .collectionId(getCollectionId(collection)) .deletesAsMoves(uniqueBooleanFieldValue(collection, SyncRequestFields.DELETES_AS_MOVES)) .windowSize(uniqueIntegerFieldValue(collection, SyncRequestFields.WINDOW_SIZE)) .options(getOptions(DOMUtils.getUniqueElement(collection, SyncRequestFields.OPTIONS.getName()))) .commands(getCommands(DOMUtils.getUniqueElement(collection, SyncRequestFields.COMMANDS.getName()))) .build(); } @Inject protected  SyncDecoder(DecoderFactory decoderFactory); SyncRequest decodeSync(Document doc); SyncResponse decodeSyncResponse(Document responseDocument);  }### Answer:
@Test public void testCollectionWhenNoClass() throws Exception { Document request = DOMUtils.parse( "<Collection>" + "<SyncKey>ddcf2e35-9834-49de-96ff-09979c7e2aa0</SyncKey>" + "<CollectionId>2</CollectionId>" + "<WindowSize>150</WindowSize>" + "</Collection>"); SyncCollection collection = new SyncDecoder(null).getCollection(request.getDocumentElement()); assertThat(collection.getDataType()).isNull(); }
@Test public void testCollectionWhenUnkownClass() throws Exception { Document request = DOMUtils.parse( "<Collection>" + "<Class>Music</Class>" + "<SyncKey>ddcf2e35-9834-49de-96ff-09979c7e2aa0</SyncKey>" + "<CollectionId>2</CollectionId>" + "<WindowSize>150</WindowSize>" + "</Collection>"); SyncCollection collection = new SyncDecoder(null).getCollection(request.getDocumentElement()); assertThat(collection.getDataType()).isNull(); }
@Test public void testCollectionWhenEmailClass() throws Exception { Document request = DOMUtils.parse( "<Collection>" + "<Class>Email</Class>" + "<SyncKey>ddcf2e35-9834-49de-96ff-09979c7e2aa0</SyncKey>" + "<CollectionId>2</CollectionId>" + "<WindowSize>150</WindowSize>" + "</Collection>"); SyncCollection collection = new SyncDecoder(null).getCollection(request.getDocumentElement()); assertThat(collection.getDataType()).isEqualTo(PIMDataType.EMAIL); }