This repository was archived by the owner on May 28, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-8
lines changed
main/java/org/glassfish/jersey/message/internal
test/java/org/glassfish/jersey/message/internal Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
3
*
4
- * Copyright (c) 2010-2015 Oracle and/or its affiliates. All rights reserved.
4
+ * Copyright (c) 2010-2016 Oracle and/or its affiliates. All rights reserved.
5
5
*
6
6
* The contents of this file are subject to the terms of either the GNU
7
7
* General Public License Version 2 only ("GPL") or the Common Development
@@ -89,10 +89,7 @@ public boolean equals(Object obj) {
89
89
return false ;
90
90
}
91
91
final AcceptableLanguageTag other = (AcceptableLanguageTag ) obj ;
92
- if (this .quality != other .quality ) {
93
- return false ;
94
- }
95
- return true ;
92
+ return this .quality == other .quality ;
96
93
}
97
94
98
95
@ Override
Original file line number Diff line number Diff line change 1
1
/*
2
2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
3
*
4
- * Copyright (c) 2010-2015 Oracle and/or its affiliates. All rights reserved.
4
+ * Copyright (c) 2010-2016 Oracle and/or its affiliates. All rights reserved.
5
5
*
6
6
* The contents of this file are subject to the terms of either the GNU
7
7
* General Public License Version 2 only ("GPL") or the Common Development
@@ -178,7 +178,7 @@ public boolean equals(final Object o) {
178
178
if (this == o ) {
179
179
return true ;
180
180
}
181
- if (!(o instanceof LanguageTag ) || o .getClass () = = this .getClass ()) {
181
+ if (!(o instanceof LanguageTag ) || o .getClass () ! = this .getClass ()) {
182
182
return false ;
183
183
}
184
184
Original file line number Diff line number Diff line change 1
1
/*
2
2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
3
*
4
- * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
4
+ * Copyright (c) 2013-2016 Oracle and/or its affiliates. All rights reserved.
5
5
*
6
6
* The contents of this file are subject to the terms of either the GNU
7
7
* General Public License Version 2 only ("GPL") or the Common Development
45
45
import org .junit .Test ;
46
46
import static org .hamcrest .MatcherAssert .assertThat ;
47
47
import static org .hamcrest .Matchers .equalToIgnoringCase ;
48
+ import static org .junit .Assert .assertFalse ;
49
+ import static org .junit .Assert .assertTrue ;
48
50
49
51
/**
50
52
* Tests for {@link LanguageTag} class.
@@ -70,6 +72,22 @@ public void testLanguageRegion() throws Exception {
70
72
_test ("es" , "419" );
71
73
}
72
74
75
+ @ Test
76
+ public void testEquals () {
77
+ LanguageTag lt1 = new LanguageTag ("en" , "us" );
78
+ LanguageTag lt2 = new LanguageTag ("en" , "us" );
79
+
80
+ assertTrue (lt1 .equals (lt2 ));
81
+ }
82
+
83
+ @ Test
84
+ public void testNonEquals () {
85
+ LanguageTag lt1 = new LanguageTag ("en" , "us" );
86
+ LanguageTag lt2 = new LanguageTag ("en" , "gb" );
87
+
88
+ assertFalse (lt1 .equals (lt2 ));
89
+ }
90
+
73
91
private void _test (final String primary , final String sub ) throws Exception {
74
92
final LanguageTag tag = LanguageTag .valueOf (primary + "-" + sub );
75
93
You can’t perform that action at this time.
0 commit comments