From 14f94c13789b8ace4eae258b5f1d64494518f9c3 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 21 Dec 2015 14:04:12 +0000
Subject: [PATCH] Remove null checks on returned values of Entry.get*Attribute*() methods.
---
opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java
index e074e8e..c4c422c 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java
@@ -26,6 +26,7 @@
*/
package org.opends.server.plugins;
+import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.StaticUtils.*;
@@ -240,7 +241,6 @@
assertNotNull(entry);
List<Attribute> sambaAttribute = entry.getAttribute("sambantpassword");
- assertNotNull(sambaAttribute);
boolean foundNTPassword = false;
for (Attribute a : sambaAttribute)
{
@@ -253,7 +253,6 @@
assertTrue(foundNTPassword, "NT password not found in test entry");
sambaAttribute = entry.getAttribute("sambalmpassword");
- assertNotNull(sambaAttribute);
boolean foundLMPassword = false;
for (Attribute a : sambaAttribute)
{
@@ -346,8 +345,8 @@
Entry entry = DirectoryServer.getEntry(testEntry.getName());
assertNotNull(entry);
- assertNull(entry.getAttribute("sambantpassword"));
- assertNull(entry.getAttribute("sambalmpassword"));
+ assertThat(entry.getAttribute("sambantpassword")).isEmpty();
+ assertThat(entry.getAttribute("sambalmpassword")).isEmpty();
TestCaseUtils.deleteEntry(entry);
}
@@ -546,14 +545,8 @@
Entry entry = DirectoryServer.getEntry(testEntry.getName());
assertNotNull(entry);
-
- List<Attribute> sambaAttribute = entry.getAttribute("sambantpassword");
-
- assertNull(sambaAttribute);
-
- sambaAttribute = entry.getAttribute("sambalmpassword");
-
- assertNull(sambaAttribute);
+ assertThat(entry.getAttribute("sambantpassword")).isEmpty();
+ assertThat(entry.getAttribute("sambalmpassword")).isEmpty();
TestCaseUtils.deleteEntry(entry);
}
--
Gitblit v1.10.0