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 11/*
22 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33 *
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.
55 *
66 * The contents of this file are subject to the terms of either the GNU
77 * General Public License Version 2 only ("GPL") or the Common Development
@@ -89,10 +89,7 @@ public boolean equals(Object obj) {
8989 return false ;
9090 }
9191 final AcceptableLanguageTag other = (AcceptableLanguageTag ) obj ;
92- if (this .quality != other .quality ) {
93- return false ;
94- }
95- return true ;
92+ return this .quality == other .quality ;
9693 }
9794
9895 @ Override
Original file line number Diff line number Diff line change 11/*
22 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33 *
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.
55 *
66 * The contents of this file are subject to the terms of either the GNU
77 * General Public License Version 2 only ("GPL") or the Common Development
@@ -178,7 +178,7 @@ public boolean equals(final Object o) {
178178 if (this == o ) {
179179 return true ;
180180 }
181- if (!(o instanceof LanguageTag ) || o .getClass () = = this .getClass ()) {
181+ if (!(o instanceof LanguageTag ) || o .getClass () ! = this .getClass ()) {
182182 return false ;
183183 }
184184
Original file line number Diff line number Diff line change 11/*
22 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33 *
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.
55 *
66 * The contents of this file are subject to the terms of either the GNU
77 * General Public License Version 2 only ("GPL") or the Common Development
4545import org .junit .Test ;
4646import static org .hamcrest .MatcherAssert .assertThat ;
4747import static org .hamcrest .Matchers .equalToIgnoringCase ;
48+ import static org .junit .Assert .assertFalse ;
49+ import static org .junit .Assert .assertTrue ;
4850
4951/**
5052 * Tests for {@link LanguageTag} class.
@@ -70,6 +72,22 @@ public void testLanguageRegion() throws Exception {
7072 _test ("es" , "419" );
7173 }
7274
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+
7391 private void _test (final String primary , final String sub ) throws Exception {
7492 final LanguageTag tag = LanguageTag .valueOf (primary + "-" + sub );
7593
You can’t perform that action at this time.
0 commit comments