directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject directory-kerberos git commit: DIRKRB-152 Switching to AssertJ framework for unit tests in kerby-asn1. Contributed by Lin Chen
Date Mon, 26 Jan 2015 06:43:40 GMT
Repository: directory-kerberos
Updated Branches:
  refs/heads/master 98e5dda06 -> dfc250909


DIRKRB-152 Switching to AssertJ framework for unit tests in kerby-asn1. Contributed by Lin
Chen


Project: http://git-wip-us.apache.org/repos/asf/directory-kerberos/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerberos/commit/dfc25090
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerberos/tree/dfc25090
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerberos/diff/dfc25090

Branch: refs/heads/master
Commit: dfc25090990feb0431682e6d00353be677ed8d90
Parents: 98e5dda
Author: Drankye <drankye@gmail.com>
Authored: Mon Jan 26 22:40:08 2015 +0800
Committer: Drankye <drankye@gmail.com>
Committed: Mon Jan 26 22:40:08 2015 +0800

----------------------------------------------------------------------
 kerby-asn1/pom.xml                              |  6 ++
 .../org/apache/kerby/asn1/TestAsn1Boolean.java  |  7 +-
 .../apache/kerby/asn1/TestAsn1Collection.java   |  9 ++-
 .../org/apache/kerby/asn1/TestAsn1Integer.java  |  7 +-
 .../kerby/asn1/TestAsn1ObjectIdentifier.java    |  7 +-
 .../org/apache/kerby/asn1/TestAsn1UtcTime.java  |  7 +-
 .../apache/kerby/asn1/TestPersonnelRecord.java  | 82 ++++++++++----------
 .../apache/kerby/asn1/TestTaggingEncoding.java  | 51 ++++++------
 pom.xml                                         |  8 ++
 9 files changed, 101 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/kerby-asn1/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-asn1/pom.xml b/kerby-asn1/pom.xml
index b667443..281199e 100644
--- a/kerby-asn1/pom.xml
+++ b/kerby-asn1/pom.xml
@@ -34,6 +34,12 @@
       <artifactId>junit</artifactId>
       <version>${junit.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>${assertj.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java
index 79e2547..536d1a9 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java
@@ -20,11 +20,12 @@
 package org.apache.kerby.asn1;
 
 import org.apache.kerby.asn1.type.Asn1Boolean;
-import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.IOException;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 public class TestAsn1Boolean {
 
     @Test
@@ -38,7 +39,7 @@ public class TestAsn1Boolean {
         Asn1Boolean aValue = new Asn1Boolean(value);
         aValue.setEncodingOption(EncodingOption.DER);
         byte[] encodingBytes = aValue.encode();
-        Assert.assertArrayEquals(expected, encodingBytes);
+        assertThat(encodingBytes).isEqualTo(expected);
     }
 
     @Test
@@ -51,6 +52,6 @@ public class TestAsn1Boolean {
         Asn1Boolean decoded = new Asn1Boolean();
         decoded.setEncodingOption(EncodingOption.DER);
         decoded.decode(Util.hex2bytes(content));
-        Assert.assertEquals(expectedValue, decoded.getValue());
+        assertThat(decoded.getValue()).isEqualTo(expectedValue);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java
index 1119d7c..b3e81fc 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Collection.java
@@ -23,11 +23,12 @@ import org.apache.kerby.asn1.type.AbstractAsn1Type;
 import org.apache.kerby.asn1.type.Asn1Boolean;
 import org.apache.kerby.asn1.type.Asn1IA5String;
 import org.apache.kerby.asn1.type.Asn1Sequence;
-import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.IOException;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 public class TestAsn1Collection {
     static String TEST_STR = "Jones";
     static Boolean TEST_BOOL = true;
@@ -42,7 +43,7 @@ public class TestAsn1Collection {
         seq.addItem(new Asn1IA5String(TEST_STR));
         seq.addItem(new Asn1Boolean(TEST_BOOL));
 
-        Assert.assertArrayEquals(EXPECTED_BYTES, seq.encode());
+        assertThat(seq.encode()).isEqualTo(EXPECTED_BYTES);
     }
 
     @Test
@@ -50,9 +51,9 @@ public class TestAsn1Collection {
         Asn1Sequence seq = new Asn1Sequence();
         seq.decode(EXPECTED_BYTES);
         AbstractAsn1Type field = (AbstractAsn1Type) seq.getValue().get(0).getValue();
-        Assert.assertEquals(TEST_STR, field.getValue());
+        assertThat(field.getValue()).isEqualTo(TEST_STR);
 
         field = (AbstractAsn1Type) seq.getValue().get(1).getValue();
-        Assert.assertEquals(TEST_BOOL, field.getValue());
+        assertThat(field.getValue()).isEqualTo(TEST_BOOL);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java
index 3ef76de..29df679 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java
@@ -20,11 +20,12 @@
 package org.apache.kerby.asn1;
 
 import org.apache.kerby.asn1.type.Asn1Integer;
-import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.IOException;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 public class TestAsn1Integer {
 
     @Test
@@ -45,7 +46,7 @@ public class TestAsn1Integer {
         Asn1Integer aValue = new Asn1Integer(value);
         aValue.setEncodingOption(EncodingOption.DER);
         byte[] encodingBytes = aValue.encode();
-        Assert.assertArrayEquals(expected, encodingBytes);
+        assertThat(encodingBytes).isEqualTo(expected);
     }
 
     @Test
@@ -65,6 +66,6 @@ public class TestAsn1Integer {
         Asn1Integer decoded = new Asn1Integer();
         decoded.setEncodingOption(EncodingOption.DER);
         decoded.decode(Util.hex2bytes(content));
-        Assert.assertEquals(expectedValue, decoded.getValue().intValue());
+        assertThat(decoded.getValue().intValue()).isEqualTo(expectedValue);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
index 04f8089..4299eab 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
@@ -20,11 +20,12 @@
 package org.apache.kerby.asn1;
 
 import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
-import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.IOException;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 public class TestAsn1ObjectIdentifier {
 
     @Test
@@ -46,7 +47,7 @@ public class TestAsn1ObjectIdentifier {
         Asn1ObjectIdentifier aValue = new Asn1ObjectIdentifier(oid);
         aValue.setEncodingOption(EncodingOption.DER);
         byte[] encodingBytes = aValue.encode();
-        Assert.assertArrayEquals(expected, encodingBytes);
+        assertThat(encodingBytes).isEqualTo(expected);
     }
 
     @Test
@@ -59,6 +60,6 @@ public class TestAsn1ObjectIdentifier {
         Asn1ObjectIdentifier decoded = new Asn1ObjectIdentifier();
         decoded.setEncodingOption(EncodingOption.DER);
         decoded.decode(Util.hex2bytes(content));
-        Assert.assertEquals(expectedValue, decoded.getValue());
+        assertThat(decoded.getValue()).isEqualTo(expectedValue);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java
index abd991b..20e5c30 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java
@@ -20,7 +20,6 @@
 package org.apache.kerby.asn1;
 
 import org.apache.kerby.asn1.type.Asn1UtcTime;
-import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.IOException;
@@ -28,6 +27,8 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.SimpleTimeZone;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 public class TestAsn1UtcTime {
 
     @Test
@@ -49,7 +50,7 @@ public class TestAsn1UtcTime {
         Asn1UtcTime aValue = new Asn1UtcTime(value);
         aValue.setEncodingOption(EncodingOption.DER);
         byte[] encodingBytes = aValue.encode();
-        Assert.assertArrayEquals(expected, encodingBytes);
+        assertThat(encodingBytes).isEqualTo(expected);
     }
 
     @Test
@@ -65,6 +66,6 @@ public class TestAsn1UtcTime {
         Asn1UtcTime decoded = new Asn1UtcTime();
         decoded.setEncodingOption(EncodingOption.DER);
         decoded.decode(Util.hex2bytes(content));
-        Assert.assertEquals(expectedValue, decoded.getValue());
+        assertThat(decoded.getValue()).isEqualTo(expectedValue);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java
index d6c8e6e..21413e8 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestPersonnelRecord.java
@@ -6,24 +6,25 @@
  *  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.kerby.asn1;
 
-import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.IOException;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /**
  * Ref. X.690-0207(http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf),
  * Annex A, A.1 ASN.1 description of the record structure
@@ -75,7 +76,7 @@ public class TestPersonnelRecord {
             System.out.println(Util.bytesToHex(encoded));
         }
 
-        Assert.assertArrayEquals(data, encoded);
+        assertThat(encoded).isEqualTo(data);
     }
 
     @Test
@@ -85,42 +86,39 @@ public class TestPersonnelRecord {
         PersonnelRecord decoded = new PersonnelRecord();
         decoded.decode(data);
 
-        Assert.assertEquals(expected.getName().getGivenName(),
-                decoded.getName().getGivenName());
-        Assert.assertEquals(expected.getName().getInitial(),
-                decoded.getName().getInitial());
-        Assert.assertEquals(expected.getName().getFamilyName(),
-                decoded.getName().getFamilyName());
-
-        Assert.assertEquals(expected.getDateOfHire().getValue().getValue(),
-                decoded.getDateOfHire().getValue().getValue());
-        Assert.assertEquals(expected.getTitle(), decoded.getTitle());
-        Assert.assertEquals(expected.getEmployeeNumber().getValue().getValue(),
-                decoded.getEmployeeNumber().getValue().getValue());
-
-        Assert.assertEquals(expected.getNameOfSpouse().getGivenName(),
-                decoded.getNameOfSpouse().getGivenName());
-        Assert.assertEquals(expected.getNameOfSpouse().getInitial(),
-                decoded.getNameOfSpouse().getInitial());
-        Assert.assertEquals(expected.getNameOfSpouse().getFamilyName(),
-                decoded.getNameOfSpouse().getFamilyName());
-
-        Assert.assertEquals(expected.getChildren().getElements().get(0).getName().getGivenName(),
-                decoded.getChildren().getElements().get(0).getName().getGivenName());
-        Assert.assertEquals(expected.getChildren().getElements().get(0).getName().getInitial(),
-                decoded.getChildren().getElements().get(0).getName().getInitial());
-        Assert.assertEquals(expected.getChildren().getElements().get(0).getName().getFamilyName(),
-                decoded.getChildren().getElements().get(0).getName().getFamilyName());
-        Assert.assertEquals(expected.getChildren().getElements().get(0).getDateOfBirth().getValue().getValue(),
-                decoded.getChildren().getElements().get(0).getDateOfBirth().getValue().getValue());
-
-        Assert.assertEquals(expected.getChildren().getElements().get(1).getName().getGivenName(),
-                decoded.getChildren().getElements().get(1).getName().getGivenName());
-        Assert.assertEquals(expected.getChildren().getElements().get(1).getName().getInitial(),
-                decoded.getChildren().getElements().get(1).getName().getInitial());
-        Assert.assertEquals(expected.getChildren().getElements().get(1).getName().getFamilyName(),
-                decoded.getChildren().getElements().get(1).getName().getFamilyName());
-        Assert.assertEquals(expected.getChildren().getElements().get(1).getDateOfBirth().getValue().getValue(),
-                decoded.getChildren().getElements().get(1).getDateOfBirth().getValue().getValue());
+        assertThat(expected.getName().getGivenName())
+                .isEqualTo(decoded.getName().getGivenName());
+        assertThat(expected.getName().getInitial())
+                .isEqualTo(decoded.getName().getInitial());
+        assertThat(expected.getName().getFamilyName())
+                .isEqualTo(decoded.getName().getFamilyName());
+        assertThat(expected.getDateOfHire().getValue().getValue())
+                .isEqualTo(decoded.getDateOfHire().getValue().getValue());
+        assertThat(decoded.getTitle())
+                .isEqualTo(expected.getTitle());
+        assertThat(expected.getEmployeeNumber().getValue().getValue())
+                .isEqualTo(decoded.getEmployeeNumber().getValue().getValue());
+        assertThat(expected.getNameOfSpouse().getGivenName())
+                .isEqualTo(decoded.getNameOfSpouse().getGivenName());
+        assertThat(expected.getNameOfSpouse().getInitial())
+                .isEqualTo(decoded.getNameOfSpouse().getInitial());
+        assertThat(expected.getNameOfSpouse().getFamilyName())
+                .isEqualTo(decoded.getNameOfSpouse().getFamilyName());
+        assertThat(expected.getChildren().getElements().get(0).getName().getGivenName())
+                .isEqualTo(decoded.getChildren().getElements().get(0).getName().getGivenName());
+        assertThat(expected.getChildren().getElements().get(0).getName().getInitial())
+                .isEqualTo(decoded.getChildren().getElements().get(0).getName().getInitial());
+        assertThat(expected.getChildren().getElements().get(0).getName().getFamilyName())
+                .isEqualTo(decoded.getChildren().getElements().get(0).getName().getFamilyName());
+        assertThat(expected.getChildren().getElements().get(0).getDateOfBirth().getValue().getValue())
+                .isEqualTo(decoded.getChildren().getElements().get(0).getDateOfBirth().getValue().getValue());
+        assertThat(expected.getChildren().getElements().get(1).getName().getGivenName())
+                .isEqualTo(decoded.getChildren().getElements().get(1).getName().getGivenName());
+        assertThat(expected.getChildren().getElements().get(1).getName().getInitial())
+                .isEqualTo(decoded.getChildren().getElements().get(1).getName().getInitial());
+        assertThat(expected.getChildren().getElements().get(1).getName().getFamilyName())
+                .isEqualTo(decoded.getChildren().getElements().get(1).getName().getFamilyName());
+        assertThat(expected.getChildren().getElements().get(1).getDateOfBirth().getValue().getValue())
+                .isEqualTo(decoded.getChildren().getElements().get(1).getDateOfBirth().getValue().getValue());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java
index 59510f1..a6ada58 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java
@@ -21,11 +21,12 @@ package org.apache.kerby.asn1;
 
 import org.apache.kerby.asn1.type.Asn1Tagging;
 import org.apache.kerby.asn1.type.Asn1VisibleString;
-import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.IOException;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /**
  Ref. X.690-0207 8.14 Encoding of a tagged value
  EXAMPLE
@@ -125,34 +126,34 @@ public class TestTaggingEncoding {
         Type4 aType4 = new Type4(aType3);
         Type5 aType5 = new Type5(aType2);
 
-        Assert.assertArrayEquals(TYPE1_EXPECTED_BYTES, aType1.encode());
-        Assert.assertArrayEquals(TYPE2_EXPECTED_BYTES, aType2.encode());
-        Assert.assertArrayEquals(TYPE3_EXPECTED_BYTES, aType3.encode());
-        Assert.assertArrayEquals(TYPE4_EXPECTED_BYTES, aType4.encode());
-        Assert.assertArrayEquals(TYPE5_EXPECTED_BYTES, aType5.encode());
+        assertThat(aType1.encode()).isEqualTo(TYPE1_EXPECTED_BYTES);
+        assertThat(aType2.encode()).isEqualTo(TYPE2_EXPECTED_BYTES);
+        assertThat(aType3.encode()).isEqualTo(TYPE3_EXPECTED_BYTES);
+        assertThat(aType4.encode()).isEqualTo(TYPE4_EXPECTED_BYTES);
+        assertThat(aType5.encode()).isEqualTo(TYPE5_EXPECTED_BYTES);
     }
 
     @Test
     public void testAsn1TaggingDecoding() throws IOException {
         Type1 aType1 = new Type1();
         aType1.decode(TYPE1_EXPECTED_BYTES);
-        Assert.assertEquals(TEST_STRING, aType1.getValue());
+        assertThat(aType1.getValue()).isEqualTo(TEST_STRING);
 
         Type2 aType2 = new Type2();
         aType2.decode(TYPE2_EXPECTED_BYTES);
-        Assert.assertEquals(TEST_STRING, aType2.getValue().getValue());
+        assertThat(aType2.getValue().getValue()).isEqualTo(TEST_STRING);
 
         Type3 aType3 = new Type3();
         aType3.decode(TYPE3_EXPECTED_BYTES);
-        Assert.assertEquals(TEST_STRING, aType3.getValue().getValue().getValue());
+        assertThat(aType3.getValue().getValue().getValue()).isEqualTo(TEST_STRING);
 
         Type4 aType4 = new Type4();
         aType4.decode(TYPE4_EXPECTED_BYTES);
-        Assert.assertEquals(TEST_STRING, aType4.getValue().getValue().getValue().getValue());
+        assertThat(aType4.getValue().getValue().getValue().getValue()).isEqualTo(TEST_STRING);
 
         Type5 aType5 = new Type5();
         aType5.decode(TYPE5_EXPECTED_BYTES);
-        Assert.assertEquals(TEST_STRING, aType5.getValue().getValue().getValue());
+        assertThat(aType5.getValue().getValue().getValue()).isEqualTo(TEST_STRING);
     }
 
     @Test
@@ -163,41 +164,41 @@ public class TestTaggingEncoding {
         Type4 aType4 = new Type4(aType3);
         Type5 aType5 = new Type5(aType2);
 
-        Assert.assertArrayEquals(TYPE1_EXPECTED_BYTES, aType1.encode());
-        Assert.assertArrayEquals(TYPE2_EXPECTED_BYTES,
-                aType1.taggedEncode(TaggingOption.newImplicitAppSpecific(3))); // for Type2
-        Assert.assertArrayEquals(TYPE3_EXPECTED_BYTES,
-                aType2.taggedEncode(TaggingOption.newExplicitContextSpecific(2))); // for
Type3
-        Assert.assertArrayEquals(TYPE4_EXPECTED_BYTES,
-                aType3.taggedEncode(TaggingOption.newImplicitAppSpecific(7))); // for Type4
-        Assert.assertArrayEquals(TYPE5_EXPECTED_BYTES,
-                aType2.taggedEncode(TaggingOption.newImplicitContextSpecific(2)));  // for
Type5
+        assertThat(aType1.encode()).isEqualTo(TYPE1_EXPECTED_BYTES);
+        assertThat(TYPE2_EXPECTED_BYTES)
+                .isEqualTo(aType1.taggedEncode(TaggingOption.newImplicitAppSpecific(3)));//
for Type2
+        assertThat(TYPE3_EXPECTED_BYTES)
+                .isEqualTo(aType2.taggedEncode(TaggingOption.newExplicitContextSpecific(2)));//
for Type3
+        assertThat(TYPE4_EXPECTED_BYTES)
+                .isEqualTo(aType3.taggedEncode(TaggingOption.newImplicitAppSpecific(7)));//
for Type4
+        assertThat(TYPE5_EXPECTED_BYTES)
+                .isEqualTo(aType2.taggedEncode(TaggingOption.newImplicitContextSpecific(2)));//
for Type5
     }
 
     @Test
     public void testTaggingDecodingOption() throws IOException {
         Type1 aType1 = new Type1();
         aType1.decode(TYPE1_EXPECTED_BYTES);
-        Assert.assertEquals(TEST_STRING, aType1.getValue());
+        assertThat(aType1.getValue()).isEqualTo(TEST_STRING);
 
         // for Type2
         aType1 = new Type1();
         aType1.taggedDecode(TYPE2_EXPECTED_BYTES, TaggingOption.newImplicitAppSpecific(3));
-        Assert.assertEquals(TEST_STRING, aType1.getValue());
+        assertThat(aType1.getValue()).isEqualTo(TEST_STRING);
 
         // for Type3
         Type2 aType2 = new Type2();
         aType2.taggedDecode(TYPE3_EXPECTED_BYTES, TaggingOption.newExplicitContextSpecific(2));
-        Assert.assertEquals(TEST_STRING, aType2.getValue().getValue());
+        assertThat(aType2.getValue().getValue()).isEqualTo(TEST_STRING);
 
         // for Type4
         Type3 aType3 = new Type3();
         aType3.taggedDecode(TYPE4_EXPECTED_BYTES, TaggingOption.newImplicitAppSpecific(7));
-        Assert.assertEquals(TEST_STRING, aType3.getValue().getValue().getValue());
+        assertThat(aType3.getValue().getValue().getValue()).isEqualTo(TEST_STRING);
 
         // for Type5
         aType2 = new Type2();
         aType2.taggedDecode(TYPE5_EXPECTED_BYTES, TaggingOption.newImplicitContextSpecific(2));
-        Assert.assertEquals(TEST_STRING, aType2.getValue().getValue());
+        assertThat(aType2.getValue().getValue()).isEqualTo(TEST_STRING);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/dfc25090/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7054f67..c48f2e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,6 +28,7 @@
   <properties>
     <junit.version>4.12</junit.version>
     <slf4j.version>1.7.10</slf4j.version>
+    <assertj.version>1.7.1</assertj.version>
   </properties>
 
   <prerequisites>
@@ -55,6 +56,13 @@
       </dependency>
 
       <dependency>
+        <groupId>org.assertj</groupId>
+        <artifactId>assertj-core</artifactId>
+        <version>${assertj.version}</version>
+        <scope>test</scope>
+      </dependency>
+
+      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <version>${slf4j.version}</version>


Mime
View raw message