From 76b91f2c1f0705bbe96d0b3ff33100c06feffe1c Mon Sep 17 00:00:00 2001 From: Marco Vogt Date: Fri, 19 Apr 2024 15:38:06 +0200 Subject: [PATCH] Fix typos and adjust tests --- .../NamedValueProcessorTest.java | 43 ++++++++++++ .../NamedValueProcssorTest.java | 67 ------------------- .../db/protointerface/ProtoValueTest.java | 4 +- 3 files changed, 45 insertions(+), 69 deletions(-) create mode 100644 plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/NamedValueProcessorTest.java delete mode 100644 plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/NamedValueProcssorTest.java diff --git a/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/NamedValueProcessorTest.java b/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/NamedValueProcessorTest.java new file mode 100644 index 0000000000..049dce25ea --- /dev/null +++ b/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/NamedValueProcessorTest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019-2024 The Polypheny Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.polypheny.db.protointerface; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Test; +import org.polypheny.db.type.entity.PolyString; +import org.polypheny.db.type.entity.PolyValue; + + +public class NamedValueProcessorTest { + + @Test + public void replacePlaceholders__missingValue() { + assertThrows( PIServiceException.class, () -> { + final String statement = "select * from people where (first_name = :first_name or last_name= :last_name) and project = :project);"; + + final Map values = new HashMap<>(); + values.put( "first_name", PolyString.of( "tobias" ) ); + values.put( "last_name", PolyString.of( "hafner" ) ); + + NamedValueProcessor namedValueProcessor = new NamedValueProcessor( statement ); + } ); + } + +} diff --git a/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/NamedValueProcssorTest.java b/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/NamedValueProcssorTest.java deleted file mode 100644 index e8c055b238..0000000000 --- a/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/NamedValueProcssorTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2019-2024 The Polypheny Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.polypheny.db.protointerface; - -import static org.junit.Assert.fail; - -import java.util.HashMap; -import java.util.Map; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.polypheny.db.type.entity.PolyString; -import org.polypheny.db.type.entity.PolyValue; - - -public class NamedValueProcssorTest { - - @BeforeClass - public static void setUpClass() { - } - - - @AfterClass - public static void tearDownClass() { - } - - - @Before - public void setUp() { - } - - - @After - public void tearDown() { - } - - - @Test(expected = PIServiceException.class) - public void replacePlaceholders__missingValue() throws Exception { - final String statement = "select * from people where (first_name = :first_name or last_name= :last_name) and project = :project);"; - - final Map values = new HashMap<>(); - values.put( "first_name", PolyString.of( "tobias" ) ); - values.put( "last_name", PolyString.of( "hafner" ) ); - - //NamedValueProcessor namedValueProcessor = new NamedValueProcessor( statement ); - - fail( "No ProtoInterfaceServiceException thrown" ); - } - -} diff --git a/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/ProtoValueTest.java b/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/ProtoValueTest.java index d6167900b4..63de82e03e 100644 --- a/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/ProtoValueTest.java +++ b/plugins/proto-interface/src/test/java/org/polypheny/db/protointerface/ProtoValueTest.java @@ -38,7 +38,6 @@ import org.polypheny.db.type.entity.PolyBinary; import org.polypheny.db.type.entity.PolyBoolean; import org.polypheny.db.type.entity.PolyList; -import org.polypheny.db.type.entity.PolyLong; import org.polypheny.db.type.entity.PolyNull; import org.polypheny.db.type.entity.PolyString; import org.polypheny.db.type.entity.PolyUserDefinedValue; @@ -48,6 +47,7 @@ import org.polypheny.db.type.entity.numerical.PolyDouble; import org.polypheny.db.type.entity.numerical.PolyFloat; import org.polypheny.db.type.entity.numerical.PolyInteger; +import org.polypheny.db.type.entity.numerical.PolyLong; import org.polypheny.db.type.entity.temporal.PolyDate; import org.polypheny.db.type.entity.temporal.PolyTime; import org.polypheny.db.type.entity.temporal.PolyTimestamp; @@ -106,7 +106,7 @@ public static PolyUserDefinedValue buildTestUdt() { @Test - public void polyBigDecimalSeriaizationTest() { + public void polyBigDecimalSerializationTest() { BigDecimal expectedValue = new BigDecimal( 1691879380700L ); PolyBigDecimal expected = new PolyBigDecimal( expectedValue ); ProtoValue protoValue = PolyValueSerializer.serialize( expected );