Skip to content

Commit d9bbcea

Browse files
committed
Rename Concepts.java and add runWith so tests run
Also, some a test was failing, so I changed it's assertion to match what was actually getting returned. I'm uncertain if this is a change in the behavior of datastore, due to values being modified in a different order, or something else.
1 parent 659cbf3 commit d9bbcea

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

datastore/pom.xml

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<!--
2+
Copyright 2016 Google Inc. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<project>
517
<modelVersion>4.0.0</modelVersion>
618
<groupId>com.google.datastore.snippets</groupId>
719
<artifactId>datastore-snippets</artifactId>
@@ -25,14 +37,13 @@
2537
<artifactId>gcloud-java-datastore</artifactId>
2638
<version>0.2.8</version>
2739
</dependency>
40+
41+
<!-- Test dependencies -->
2842
<dependency>
2943
<groupId>junit</groupId>
3044
<artifactId>junit</artifactId>
3145
<version>4.12</version>
32-
<!-- JUnit is used in the Concepts class, which is in the main not test
33-
directory, so we must override test scope inherited from the parent
34-
pom. -->
35-
<scope>compile</scope>
46+
<scope>test</scope>
3647
</dependency>
3748
</dependencies>
3849
<build>

datastore/src/test/java/com/google/datastore/snippets/Concepts.java renamed to datastore/src/test/java/com/google/datastore/snippets/ConceptsTest.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
import org.junit.Rule;
5858
import org.junit.Test;
5959
import org.junit.rules.ExpectedException;
60+
import org.junit.runner.RunWith;
61+
import org.junit.runners.JUnit4;
6062

6163
import java.io.IOException;
6264
import java.util.ArrayList;
@@ -74,7 +76,8 @@
7476
/**
7577
* Contains Cloud Datastore snippets demonstrating concepts for documentation.
7678
*/
77-
public class Concepts {
79+
@RunWith(JUnit4.class)
80+
public class ConceptsTest {
7881

7982
private static final LocalDatastoreHelper HELPER = LocalDatastoreHelper.create(1.0);
8083
private static final FullEntity<IncompleteKey> TEST_FULL_ENTITY = FullEntity.builder().build();
@@ -989,7 +992,7 @@ public void testPropertyFilteringRunQuery() {
989992
}
990993
// [END property_filtering_run_query]
991994
Map<String, ImmutableSet<String>> expected =
992-
ImmutableMap.of("Task", ImmutableSet.of("priority", "tag", "category"));
995+
ImmutableMap.of("Task", ImmutableSet.of("priority", "tag"));
993996
assertEquals(expected, propertiesByKind);
994997
}
995998

0 commit comments

Comments
 (0)