Fix some miscellaneous bugs (#3567)
This commit is contained in:
parent
7d3b285b6b
commit
114a74f35a
|
|
@ -51,7 +51,7 @@ public abstract class AbstractTag<T> {
|
|||
}
|
||||
|
||||
public boolean sameWith(AbstractTag<T> tag) {
|
||||
return canOverwrite && tag.id == tag.id;
|
||||
return canOverwrite && this.id == tag.id;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public class SourceColumn {
|
|||
case "String":
|
||||
this.type = String.class;
|
||||
typeName = "String";
|
||||
break;
|
||||
default:
|
||||
try {
|
||||
this.type = Class.forName(typeName);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.apache.skywalking.oap.server.core.analysis.metrics.expression;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
|
|
@ -39,19 +41,19 @@ public class EqualMatch {
|
|||
}
|
||||
|
||||
public boolean match(Integer left, Integer right) {
|
||||
return left == right;
|
||||
return Objects.equals(left, right);
|
||||
}
|
||||
|
||||
public boolean match(Long left, Long right) {
|
||||
return left == right;
|
||||
return Objects.equals(left, right);
|
||||
}
|
||||
|
||||
public boolean match(Float left, Float right) {
|
||||
return left == right;
|
||||
return Objects.equals(left, right);
|
||||
}
|
||||
|
||||
public boolean match(Double left, Double right) {
|
||||
return left == right;
|
||||
return Objects.equals(left, right);
|
||||
}
|
||||
|
||||
public boolean match(Boolean left, Boolean right) {
|
||||
|
|
@ -63,6 +65,6 @@ public class EqualMatch {
|
|||
}
|
||||
|
||||
public boolean match(Object left, Object right) {
|
||||
return left.equals(right);
|
||||
return Objects.equals(left, right);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.apache.skywalking.oap.server.core.analysis.metrics.expression;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author kezhenxu94
|
||||
*/
|
||||
public class EqualMatchTest {
|
||||
|
||||
@Test
|
||||
public void integerShouldEqualWhenLargerThan128() {
|
||||
Integer a = 334;
|
||||
Integer b = 334;
|
||||
boolean match = new EqualMatch().match(a, b);
|
||||
assertTrue(match);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void longShouldEqualWhenLargerThan128() {
|
||||
Long a = 334L;
|
||||
Long b = 334L;
|
||||
boolean match = new EqualMatch().match(a, b);
|
||||
assertTrue(match);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doubleShouldEqualWhenLargerThan128() {
|
||||
Double a = 334.0;
|
||||
Double b = 334.0;
|
||||
boolean match = new EqualMatch().match(a, b);
|
||||
assertTrue(match);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void floatShouldEqualWhenLargerThan128() {
|
||||
Float a = 334.0F;
|
||||
Float b = 334.0F;
|
||||
boolean match = new EqualMatch().match(a, b);
|
||||
assertTrue(match);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue