rdblue commented on a change in pull request #1342:
URL: https://github.com/apache/iceberg/pull/1342#discussion_r470834476



##########
File path: core/src/test/java/org/apache/iceberg/hadoop/TestStaticTable.java
##########
@@ -0,0 +1,79 @@
+package org.apache.iceberg.hadoop;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+import org.apache.iceberg.HasTableOperations;
+import org.apache.iceberg.MetadataTableType;
+import org.apache.iceberg.StaticTableOperations;
+import org.apache.iceberg.Table;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestStaticTable extends HadoopTableTestBase {
+
+  private Table getStaticTable() {
+    return TABLES.load(((HasTableOperations) 
table).operations().current().metadataFileLocation());
+  }
+
+  private Table getStaticTable(MetadataTableType type) {
+    return TABLES.load(((HasTableOperations) 
table).operations().current().metadataFileLocation() + "#" + type);
+  }
+
+  @Test
+  public void testLoadFromMetadata() {
+    Table staticTable = getStaticTable();
+    Assert.assertTrue("Loading a metadata file based table should return 
StaticTableOperations",
+        ((HasTableOperations) staticTable).operations() instanceof 
StaticTableOperations);
+  }
+
+  @Test(expected = UnsupportedOperationException.class)
+  public void testCannotBeAddedTo(){
+    Table staticTable = getStaticTable();
+    staticTable.newOverwrite().addFile(FILE_A).commit();
+  }
+
+  @Test(expected = UnsupportedOperationException.class)

Review comment:
       We typically use `AssertHelpers.assertThrows` instead of `expected` 
because that allows you to validate the exception message and make assertions 
after the failure. For example, this should assert that the value of 
`table.current()` before the commit is the same object as `table.refresh()` 
after the failed commit.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to