Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit ed5d7a0

Browse files
author
Caitlin Bales (MSFT)
committed
Format Excel tests
1 parent d4af2c0 commit ed5d7a0

File tree

1 file changed

+14
-24
lines changed
  • graphsdk/src/androidTest/java/com/microsoft/graph/functional

1 file changed

+14
-24
lines changed

graphsdk/src/androidTest/java/com/microsoft/graph/functional/ExcelTests.java

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.google.gson.JsonArray;
77
import com.google.gson.JsonElement;
88
import com.google.gson.JsonObject;
9+
import com.google.gson.JsonPrimitive;
910
import com.microsoft.graph.extensions.DriveItem;
1011
import com.microsoft.graph.extensions.File;
1112
import com.microsoft.graph.extensions.IDirectoryObjectCollectionPage;
@@ -28,33 +29,22 @@ public class ExcelTests extends AndroidTestCase {
2829
public void setUp()
2930
{
3031
testBase = new TestBase();
31-
fileId = createTestFile("_excelTestResourceAndroid.xlsx");
32-
3332
}
3433

35-
public String createTestFile(String fileName)
36-
{
37-
try {
38-
DriveItem excelWorkbook = new DriveItem();
39-
excelWorkbook.name = fileName;
40-
excelWorkbook.file = new File();
41-
42-
DriveItem driveItem = testBase.graphClient.getMe().getDrive().getRoot().getChildren().buildRequest().post(excelWorkbook);
43-
return driveItem.id;
44-
}
45-
catch (GraphServiceException ex) {
46-
// File could not be created successfully
47-
}
48-
return null;
49-
}
50-
51-
5234
public void testCreateNamedItem() {
53-
// JsonObject range = new JsonObject();
54-
// range.addProperty("address", "Sheet1!A1");
55-
// WorkbookNamedItem item = testBase.graphClient.getMe().getDrive().getItems("015U5LKCVICVSIQ6DKOVELGXD3WAEHMMAI").getWorkbook().getNames().getAdd("named-range", range, "Comment").buildRequest().post();
56-
// assertNotNull(item);
57-
// assertEquals("named-range", item.name);
35+
JsonObject range = new JsonObject();
36+
range.addProperty("address", "Sheet1!A1");
37+
WorkbookNamedItem item = testBase.graphClient
38+
.getMe()
39+
.getDrive()
40+
.getItems("015U5LKCVICVSIQ6DKOVELGXD3WAEHMMAI")
41+
.getWorkbook()
42+
.getNames()
43+
.getAdd("testNamedRange", new JsonPrimitive("Sheet1!A1"), "Comment")
44+
.buildRequest()
45+
.post();
46+
assertNotNull(item);
47+
assertEquals("testNamedRange", item.name);
5848
}
5949

6050
public void testGetNamedItems() {

0 commit comments

Comments
 (0)