Skip to content

Commit b7b53f7

Browse files
committed
- adds a unit test for single value properties
1 parent 1f3337a commit b7b53f7

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/test/java/com/microsoft/graph/functional/OutlookTests.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.junit.Assert.assertFalse;
44
import static org.junit.Assert.assertNotNull;
5+
import static org.junit.Assert.assertTrue;
56

67
import java.io.ByteArrayOutputStream;
78
import java.io.File;
@@ -12,6 +13,7 @@
1213
import java.util.ArrayList;
1314
import java.util.Arrays;
1415
import java.util.List;
16+
import java.util.UUID;
1517

1618
import javax.xml.datatype.DatatypeFactory;
1719
import javax.xml.datatype.Duration;
@@ -36,6 +38,7 @@
3638
import com.microsoft.graph.models.extensions.MeetingTimeSuggestionsResult;
3739
import com.microsoft.graph.models.extensions.Message;
3840
import com.microsoft.graph.models.extensions.Recipient;
41+
import com.microsoft.graph.models.extensions.SingleValueLegacyExtendedProperty;
3942
import com.microsoft.graph.models.extensions.UploadSession;
4043
import com.microsoft.graph.models.extensions.User;
4144
import com.microsoft.graph.models.generated.AttachmentType;
@@ -44,7 +47,11 @@
4447
import com.microsoft.graph.requests.extensions.AttachmentCollectionPage;
4548
import com.microsoft.graph.requests.extensions.IMessageCollectionPage;
4649
import com.microsoft.graph.requests.extensions.IUserCollectionPage;
50+
import com.microsoft.graph.requests.extensions.SingleValueLegacyExtendedPropertyCollectionPage;
51+
import com.microsoft.graph.requests.extensions.SingleValueLegacyExtendedPropertyCollectionRequestBuilder;
52+
import com.microsoft.graph.requests.extensions.SingleValueLegacyExtendedPropertyCollectionResponse;
4753
import com.microsoft.graph.requests.extensions.AttachmentCollectionResponse;
54+
import com.microsoft.graph.requests.extensions.IEventCollectionPage;
4855

4956
@Ignore
5057
public class OutlookTests {
@@ -313,5 +320,33 @@ public void testSendDraftWithLargeAttachements() throws FileNotFoundException, I
313320

314321
//Send the drafted message
315322
testBase.graphClient.me().mailFolders("Drafts").messages(newMessage.id).send().buildRequest().post();
316-
}
323+
}
324+
@Test
325+
public void testSingleValuesExtendedProperties() {
326+
final TestBase testBase = new TestBase();
327+
final IEventCollectionPage arrangePage = testBase.graphClient.me().events().buildRequest().top(1).get();
328+
final String eventId = arrangePage.getCurrentPage().get(0).id;
329+
final Event updatedEvent = new Event();
330+
final String uuid = UUID.randomUUID().toString();
331+
final SingleValueLegacyExtendedProperty prop = new SingleValueLegacyExtendedProperty();
332+
prop.id = "String {"+uuid+"} Name fun";
333+
prop.value = "some value";
334+
final SingleValueLegacyExtendedPropertyCollectionResponse response = new SingleValueLegacyExtendedPropertyCollectionResponse();
335+
response.value = new ArrayList<SingleValueLegacyExtendedProperty>();
336+
response.value.add(prop);
337+
updatedEvent.singleValueExtendedProperties = new SingleValueLegacyExtendedPropertyCollectionPage(response, new SingleValueLegacyExtendedPropertyCollectionRequestBuilder(null, null, null));
338+
339+
testBase.graphClient.me().events(eventId).buildRequest().patch(updatedEvent);
340+
final IEventCollectionPage page = testBase.graphClient.me()
341+
.events()
342+
.buildRequest()
343+
.expand("singleValueExtendedProperties")
344+
.top(1)
345+
// .filter("singleValueExtendedProperties/Any(ep: ep/id eq '"+prop.id+"' and ep/value eq '"+prop.value+"')")
346+
.get();
347+
assertNotNull(page);
348+
final List<Event> events = page.getCurrentPage();
349+
assertTrue(events.size() == 1);
350+
assertNotNull(events.get(0).singleValueExtendedProperties);
351+
}
317352
}

0 commit comments

Comments
 (0)