Skip to content

Commit

Permalink
chore: remove unused throws from test methods (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
athakor authored and BenWhitehead committed Jan 9, 2020
1 parent f53ea41 commit 6391955
Show file tree
Hide file tree
Showing 29 changed files with 133 additions and 133 deletions.
Expand Up @@ -79,7 +79,7 @@ public void tearDown() {
}

@Test
public void testAdd() throws Exception {
public void testAdd() {
Entity entity2 =
Entity.newBuilder(ENTITY2).setKey(Key.newBuilder(KEY1).setName("name2").build()).build();
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
Expand All @@ -103,7 +103,7 @@ public void testAdd() throws Exception {
}

@Test
public void testAddAfterDelete() throws Exception {
public void testAddAfterDelete() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(ENTITY1.toPb()).build());
batchWriter.delete(KEY1);
Expand All @@ -112,31 +112,31 @@ public void testAddAfterDelete() throws Exception {
}

@Test(expected = DatastoreException.class)
public void testAddDuplicate() throws Exception {
public void testAddDuplicate() {
batchWriter.add(ENTITY1);
batchWriter.add(ENTITY1);
}

@Test(expected = DatastoreException.class)
public void testAddAfterPut() throws Exception {
public void testAddAfterPut() {
batchWriter.put(ENTITY1);
batchWriter.add(ENTITY1);
}

@Test(expected = DatastoreException.class)
public void testAddAfterUpdate() throws Exception {
public void testAddAfterUpdate() {
batchWriter.update(ENTITY1);
batchWriter.add(ENTITY1);
}

@Test(expected = DatastoreException.class)
public void testAddWhenNotActive() throws Exception {
public void testAddWhenNotActive() {
batchWriter.deactivate();
batchWriter.add(ENTITY1);
}

@Test
public void testAddWithDeferredAllocation() throws Exception {
public void testAddWithDeferredAllocation() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(
com.google.datastore.v1.Mutation.newBuilder()
Expand All @@ -153,13 +153,13 @@ public void testAddWithDeferredAllocation() throws Exception {
}

@Test(expected = DatastoreException.class)
public void testAddWithDeferredAllocationWhenNotActive() throws Exception {
public void testAddWithDeferredAllocationWhenNotActive() {
batchWriter.deactivate();
batchWriter.addWithDeferredIdAllocation(INCOMPLETE_ENTITY_1);
}

@Test
public void testUpdate() throws Exception {
public void testUpdate() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpdate(ENTITY1.toPb()).build());
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpdate(ENTITY2.toPb()).build());
Expand All @@ -170,7 +170,7 @@ public void testUpdate() throws Exception {
}

@Test
public void testUpdateAfterUpdate() throws Exception {
public void testUpdateAfterUpdate() {
Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build();
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpdate(entity.toPb()).build());
Expand All @@ -180,7 +180,7 @@ public void testUpdateAfterUpdate() throws Exception {
}

@Test
public void testUpdateAfterAdd() throws Exception {
public void testUpdateAfterAdd() {
Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build();
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build());
Expand All @@ -190,7 +190,7 @@ public void testUpdateAfterAdd() throws Exception {
}

@Test
public void testUpdateAfterPut() throws Exception {
public void testUpdateAfterPut() {
Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build();
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build());
Expand All @@ -200,19 +200,19 @@ public void testUpdateAfterPut() throws Exception {
}

@Test(expected = DatastoreException.class)
public void testUpdateAfterDelete() throws Exception {
public void testUpdateAfterDelete() {
batchWriter.delete(KEY1);
batchWriter.update(ENTITY1, ENTITY2);
}

@Test(expected = DatastoreException.class)
public void testUpdateWhenNotActive() throws Exception {
public void testUpdateWhenNotActive() {
batchWriter.deactivate();
batchWriter.update(ENTITY1);
}

@Test
public void testPut() throws Exception {
public void testPut() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(ENTITY1.toPb()).build());
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(ENTITY2.toPb()).build());
Expand All @@ -226,7 +226,7 @@ public void testPut() throws Exception {
}

@Test
public void testPutIncompleteKey() throws Exception {
public void testPutIncompleteKey() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(ENTITY1.toPb()).build());
pbs.add(
Expand All @@ -246,7 +246,7 @@ public void testPutIncompleteKey() throws Exception {
}

@Test
public void testPutWithDeferredAllocation() throws Exception {
public void testPutWithDeferredAllocation() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(
com.google.datastore.v1.Mutation.newBuilder()
Expand All @@ -263,7 +263,7 @@ public void testPutWithDeferredAllocation() throws Exception {
}

@Test
public void testPutAfterPut() throws Exception {
public void testPutAfterPut() {
Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build();
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build());
Expand All @@ -275,7 +275,7 @@ public void testPutAfterPut() throws Exception {
}

@Test
public void testPutAfterAdd() throws Exception {
public void testPutAfterAdd() {
Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build();
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build());
Expand All @@ -285,7 +285,7 @@ public void testPutAfterAdd() throws Exception {
}

@Test
public void testPutAfterUpdate() throws Exception {
public void testPutAfterUpdate() {
Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build();
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build());
Expand All @@ -296,7 +296,7 @@ public void testPutAfterUpdate() throws Exception {
}

@Test
public void testPutAfterDelete() throws Exception {
public void testPutAfterDelete() {
Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build();
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build());
Expand All @@ -307,13 +307,13 @@ public void testPutAfterDelete() throws Exception {
}

@Test(expected = DatastoreException.class)
public void testPutWhenNotActive() throws Exception {
public void testPutWhenNotActive() {
batchWriter.deactivate();
batchWriter.put(ENTITY1);
}

@Test
public void testDelete() throws Exception {
public void testDelete() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setDelete(KEY1.toPb()).build());
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setDelete(KEY2.toPb()).build());
Expand All @@ -324,7 +324,7 @@ public void testDelete() throws Exception {
}

@Test
public void testDeleteAfterAdd() throws Exception {
public void testDeleteAfterAdd() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(
com.google.datastore.v1.Mutation.newBuilder()
Expand All @@ -338,7 +338,7 @@ public void testDeleteAfterAdd() throws Exception {
}

@Test
public void testDeleteAfterUpdate() throws Exception {
public void testDeleteAfterUpdate() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setDelete(KEY1.toPb()).build());
batchWriter.update(ENTITY1);
Expand All @@ -347,7 +347,7 @@ public void testDeleteAfterUpdate() throws Exception {
}

@Test
public void testDeleteAfterPut() throws Exception {
public void testDeleteAfterPut() {
List<com.google.datastore.v1.Mutation> pbs = new LinkedList<>();
pbs.add(com.google.datastore.v1.Mutation.newBuilder().setDelete(KEY1.toPb()).build());
batchWriter.put(ENTITY1);
Expand All @@ -356,7 +356,7 @@ public void testDeleteAfterPut() throws Exception {
}

@Test(expected = DatastoreException.class)
public void testDeleteWhenNotActive() throws Exception {
public void testDeleteWhenNotActive() {
batchWriter.deactivate();
batchWriter.delete(KEY1);
}
Expand Down
Expand Up @@ -79,7 +79,7 @@ public void setUp() {
}

@Test
public void testContains() throws Exception {
public void testContains() {
BaseEntity<Key> entity = builder.build();
assertTrue(entity.contains("list1"));
assertFalse(entity.contains("bla"));
Expand All @@ -88,19 +88,19 @@ public void testContains() throws Exception {
}

@Test
public void testGetValue() throws Exception {
public void testGetValue() {
BaseEntity<Key> entity = builder.build();
assertEquals(BlobValue.of(BLOB), entity.getValue("blob"));
}

@Test(expected = DatastoreException.class)
public void testGetValueNotFound() throws Exception {
public void testGetValueNotFound() {
BaseEntity<Key> entity = builder.clear().build();
entity.getValue("blob");
}

@Test
public void testIsNull() throws Exception {
public void testIsNull() {
BaseEntity<Key> entity = builder.build();
assertTrue(entity.isNull("null"));
assertFalse(entity.isNull("blob"));
Expand All @@ -109,13 +109,13 @@ public void testIsNull() throws Exception {
}

@Test(expected = DatastoreException.class)
public void testIsNullNotFound() throws Exception {
public void testIsNullNotFound() {
BaseEntity<Key> entity = builder.clear().build();
entity.isNull("null");
}

@Test
public void testGetString() throws Exception {
public void testGetString() {
BaseEntity<Key> entity = builder.build();
assertEquals("hello world", entity.getString("string"));
assertEquals("bla", entity.getString("stringValue"));
Expand All @@ -124,15 +124,15 @@ public void testGetString() throws Exception {
}

@Test
public void testGetLong() throws Exception {
public void testGetLong() {
BaseEntity<Key> entity = builder.build();
assertEquals(125, entity.getLong("long"));
entity = builder.set("long", LongValue.of(10)).build();
assertEquals(10, entity.getLong("long"));
}

@Test
public void testGetDouble() throws Exception {
public void testGetDouble() {
BaseEntity<Key> entity = builder.build();
assertEquals(1.25, entity.getDouble("double"), 0);
entity = builder.set("double", DoubleValue.of(10)).build();
Expand All @@ -148,7 +148,7 @@ public void testGetBoolean() throws Exception {
}

@Test
public void testGetTimestamp() throws Exception {
public void testGetTimestamp() {
BaseEntity<Key> entity = builder.build();
assertEquals(TIMESTAMP, entity.getTimestamp("timestamp"));
Calendar cal = Calendar.getInstance();
Expand All @@ -159,13 +159,13 @@ public void testGetTimestamp() throws Exception {
}

@Test
public void testGetLatLng() throws Exception {
public void testGetLatLng() {
BaseEntity<Key> entity = builder.build();
assertEquals(LAT_LNG, entity.getLatLng("latLng"));
}

@Test
public void testGetKey() throws Exception {
public void testGetKey() {
BaseEntity<Key> entity = builder.build();
assertEquals(KEY, entity.getKey("key"));
Key key = Key.newBuilder(KEY).setName("BLA").build();
Expand All @@ -174,7 +174,7 @@ public void testGetKey() throws Exception {
}

@Test
public void testGetEntity() throws Exception {
public void testGetEntity() {
BaseEntity<Key> entity = builder.build();
assertEquals(ENTITY, entity.getEntity("entity"));
assertEquals(PARTIAL_ENTITY, entity.getEntity("partialEntity"));
Expand All @@ -183,7 +183,7 @@ public void testGetEntity() throws Exception {
}

@Test
public void testGetList() throws Exception {
public void testGetList() {
BaseEntity<Key> entity = builder.build();
List<? extends Value<?>> list = entity.getList("list1");
assertEquals(3, list.size());
Expand Down Expand Up @@ -213,7 +213,7 @@ public void testGetList() throws Exception {
}

@Test
public void testGetBlob() throws Exception {
public void testGetBlob() {
BaseEntity<Key> entity = builder.build();
assertEquals(BLOB, entity.getBlob("blob"));
Blob blob = Blob.copyFrom(new byte[] {});
Expand All @@ -222,7 +222,7 @@ public void testGetBlob() throws Exception {
}

@Test
public void testNames() throws Exception {
public void testNames() {
Set<String> names =
ImmutableSet.<String>builder()
.add("string", "stringValue", "boolean", "double", "long", "list1", "list2", "list3")
Expand All @@ -236,7 +236,7 @@ public void testNames() throws Exception {
}

@Test
public void testKey() throws Exception {
public void testKey() {
builder.setKey(KEY);
BaseEntity<Key> entity = builder.build();
assertEquals(KEY, entity.getKey());
Expand Down

0 comments on commit 6391955

Please sign in to comment.