From 1d04a279451b57014451f2d22655e53a470f9fec Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Tue, 4 Jan 2022 11:48:14 +0100 Subject: Avoid deprecated APIs --- .../com/yahoo/documentmodel/VespaDocumentType.java | 2 +- .../java/com/yahoo/searchdefinition/RankProfile.java | 2 +- .../searchdefinition/document/SDDocumentType.java | 7 ++++--- .../java/com/yahoo/config/provision/ZoneIdTest.java | 18 ++++++++---------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/config-model/src/main/java/com/yahoo/documentmodel/VespaDocumentType.java b/config-model/src/main/java/com/yahoo/documentmodel/VespaDocumentType.java index b29e4704f62..02f5a8c12c4 100644 --- a/config-model/src/main/java/com/yahoo/documentmodel/VespaDocumentType.java +++ b/config-model/src/main/java/com/yahoo/documentmodel/VespaDocumentType.java @@ -14,7 +14,7 @@ import com.yahoo.document.PositionDataType; */ public class VespaDocumentType { - public static NewDocumentType INSTANCE = newInstance(); + public static final NewDocumentType INSTANCE = newInstance(); public static final DataTypeName NAME = new DataTypeName("document"); diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java index 52fd5286bcf..d484d32b02f 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java @@ -517,7 +517,7 @@ public class RankProfile implements Cloneable { public void setInheritedSummaryFeatures(String parentProfile) { if ( ! parentProfile.equals(inheritedName)) throw new IllegalArgumentException("This can only inherit the summary features of its parent, '" + - inheritedName + ", but attemtping to inherit '" + parentProfile); + inheritedName + ", but attempting to inherit '" + parentProfile); this.inheritedSummaryFeatures = parentProfile; } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java index 60b06d3655c..e627f06ad42 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java @@ -31,8 +31,8 @@ import java.util.Set; * implicitly acquiring their fields as it's own. If a document is not set to inherit * any document, it will always inherit the document "document.0". * - * @author Thomas Gundersen - * @author bratseth + * @author Thomas Gundersen + * @author bratseth */ public class SDDocumentType implements Cloneable, Serializable { @@ -42,7 +42,8 @@ public class SDDocumentType implements Cloneable, Serializable { private final AnnotationTypeRegistry annotationTypes = new AnnotationTypeRegistry(); private DocumentType docType; private DataType structType; - // The field sets here are set from the processing step in SD, to ensure that the full Search and this SDDocumentType is built first. + // The field sets here are set from the processing step in SD, + // to ensure that the full Search and this SDDocumentType is built first. private FieldSets fieldSets; // Document references private Optional documentReferences = Optional.empty(); diff --git a/config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java b/config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java index fb141f1889e..ae61be8f2e9 100644 --- a/config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java +++ b/config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java @@ -2,11 +2,10 @@ package com.yahoo.config.provision; import com.yahoo.config.provision.zone.ZoneId; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; /** * @author hmusum @@ -15,11 +14,6 @@ public class ZoneIdTest { private static final Environment environment = Environment.prod; private static final RegionName region = RegionName.from("moon-dark-side-1"); - private static final CloudName cloud = CloudName.from("aws"); - private static final SystemName system = SystemName.Public; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); @Test public void testCreatingZoneId() { @@ -35,9 +29,13 @@ public class ZoneIdTest { assertEquals(ZoneId.from(zoneId.value()), zoneId); String serializedZoneId = "some.illegal.value"; - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Cannot deserialize zone id '" + serializedZoneId + "'"); - ZoneId.from(serializedZoneId); + try { + ZoneId.from(serializedZoneId); + fail("Expected exception"); + } + catch (IllegalArgumentException e) { + assertEquals("Cannot deserialize zone id '" + serializedZoneId + "'", e.getMessage()); + } } } -- cgit v1.2.3