Skip to content

Add getInstance to TypeSystem #1323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions driver/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,10 @@
<differenceType>3003</differenceType>
</difference>

<difference>
<className>org/neo4j/driver/types/TypeSystem</className>
<differenceType>7012</differenceType>
<method>org.neo4j.driver.types.TypeSystem getInstance()</method>
</difference>

</differences>
11 changes: 11 additions & 0 deletions driver/src/main/java/org/neo4j/driver/types/TypeSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.neo4j.driver.types;

import static org.neo4j.driver.internal.types.InternalTypeSystem.TYPE_SYSTEM;

import org.neo4j.driver.util.Experimental;
import org.neo4j.driver.util.Immutable;

Expand All @@ -28,6 +30,15 @@
@Immutable
@Experimental
public interface TypeSystem {
/**
* Returns an instance of type system.
*
* @return instance of type system
*/
static TypeSystem getInstance() {
return TYPE_SYSTEM;
}

Type ANY();

Type BOOLEAN();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.junit.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.neo4j.driver.Values.value;
import static org.neo4j.driver.internal.types.InternalTypeSystem.TYPE_SYSTEM;

Expand Down Expand Up @@ -75,6 +76,11 @@ private TypeVerifier newTypeVerifierFor(Type type) {
return new TypeVerifier(type, allValues);
}

@Test
void shouldReturnTypeSystem() {
assertEquals(TYPE_SYSTEM, TypeSystem.getInstance());
}

@Test
void shouldNameTypeCorrectly() {
assertThat(TYPE_SYSTEM.ANY().name(), is("ANY"));
Expand Down