diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java b/src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java
index 0d146b7..4e64089 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java
@@ -24,6 +24,8 @@
 
 import org.onap.dmaap.dbcapi.util.RandomString;
 
+import java.util.Objects;
+
 @XmlRootElement
 public class DR_Pub extends DmaapObject {
 
@@ -151,5 +153,35 @@
 		return ri.nextString();
 		
 	}
-	
+
+	@Override
+	public boolean equals(Object o) {
+		if (this == o) return true;
+		if (o == null || getClass() != o.getClass()) return false;
+		DR_Pub dr_pub = (DR_Pub) o;
+		return Objects.equals(dcaeLocationName, dr_pub.dcaeLocationName) &&
+				Objects.equals(username, dr_pub.username) &&
+				Objects.equals(userpwd, dr_pub.userpwd) &&
+				Objects.equals(feedId, dr_pub.feedId) &&
+				Objects.equals(pubId, dr_pub.pubId);
+	}
+
+	@Override
+	public int hashCode() {
+
+		return Objects.hash(dcaeLocationName, username, userpwd, feedId, pubId);
+	}
+
+	@Override
+	public String toString() {
+		return "DR_Pub{" +
+				"dcaeLocationName='" + dcaeLocationName + '\'' +
+				", username='" + username + '\'' +
+				", userpwd='" + userpwd + '\'' +
+				", feedId='" + feedId + '\'' +
+				", pubId='" + pubId + '\'' +
+				", feedName='" + feedName + '\'' +
+				", feedVersion='" + feedVersion + '\'' +
+				'}';
+	}
 }
diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
index 928a7e2..6e652a8 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
@@ -104,8 +104,9 @@
 			}
 			// if we found a FeedName instead of a FeedId then try to look it up.
 			List<Feed> nfeeds =  feeds.getAllFeeds( pub.getFeedName(), pub.getFeedVersion(), "equals");
-			if ( nfeeds.size() != 1 ) {
-				logger.debug( "Attempt to match "+ pub.getFeedName() + " ver="+pub.getFeedVersion() + " matched " + nfeeds.size() );
+			if ( nfeeds.isEmpty() ) {
+				apiError.setCode(Status.NOT_FOUND.getStatusCode());
+				apiError.setFields("feedName");
 				return responseBuilder.error(apiError);
 			}
 			fnew = nfeeds.get(0);
diff --git a/src/test/java/org/onap/dmaap/dbcapi/resources/DR_PubResourceTest.java b/src/test/java/org/onap/dmaap/dbcapi/resources/DR_PubResourceTest.java
index d4f71bb..bf03088 100644
--- a/src/test/java/org/onap/dmaap/dbcapi/resources/DR_PubResourceTest.java
+++ b/src/test/java/org/onap/dmaap/dbcapi/resources/DR_PubResourceTest.java
@@ -8,9 +8,9 @@
  * Licensed 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.
@@ -19,156 +19,264 @@
  * ============LICENSE_END=========================================================
  */
 package org.onap.dmaap.dbcapi.resources;
-import org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.service.*;
-import static org.junit.Assert.*;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import java.util.*;
-import java.sql.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
-import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.server.ResourceConfig;
 import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Response;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.Path;
-import javax.ws.rs.GET;
+import javax.ws.rs.core.Response;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.dmaap.dbcapi.database.DatabaseClass;
+import org.onap.dmaap.dbcapi.model.ApiError;
+import org.onap.dmaap.dbcapi.model.DR_Pub;
+import org.onap.dmaap.dbcapi.model.Feed;
+import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
 
-public class DR_PubResourceTest extends JerseyTest{
+public class DR_PubResourceTest {
 
-	@Override
-	protected Application configure() {
-		return new ResourceConfig()
-				.register( DR_PubResource.class )
-				.register( FeedResource.class );
-	}
+    private static final DmaapObjectFactory DMAAP_OBJECT_FACTORY = new DmaapObjectFactory();
 
-	private static final String  fmt = "%24s: %s%n";
-	String d, un, up, f, p;
-/*
-	@Before
-	public void setUp() throws Exception {
-		d = "central-onap";
-		un = "user1";
-		up = "secretW0rd";
-		f = "234";
-		p = "678";
-	}
+    private static final String DCAE_LOCATION_NAME = "central-onap";
+    private static final String USERNAME = "user1";
+    private static final String USRPWD = "secretW0rd";
+    private static final String FEED_ID = "someFakeFeedId";
+    private static final String PUB_ID = "0";
+    private static FastJerseyTestContainer testContainer;
+    private static TestFeedCreator testFeedCreator;
 
-	@After
-	public void tearDown() throws Exception {
-	}
-*/
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        //TODO: init is still needed here to assure that dmaap is not null
+        DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
+
+        testContainer = new FastJerseyTestContainer(new ResourceConfig()
+            .register(DR_PubResource.class)
+            .register(FeedResource.class));
+
+        testContainer.init();
+        testFeedCreator = new TestFeedCreator(testContainer);
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+        testContainer.destroy();
+        /*TODO: Cannot cleanup yet until still other Resources tests depends on the static DB content
+
+        DatabaseClass.clearDatabase();
+        DatabaseClass.getDmaap().remove();*/
+    }
+
+    @Before
+    public void cleanupDatabase() {
+        DatabaseClass.clearDatabase();
+    }
+
+    @Test
+    public void getDr_Pub_test() {
+        Response resp = testContainer.target("dr_pubs").request().get(Response.class);
+        assertTrue(resp.getStatus() == 200);
+        assertTrue(resp.hasEntity());
+    }
+
+    @Test
+    public void addDr_Pub_shallReturnError_whenNoFeedIdAndFeedNameInPubProvided() {
+        //given
+        DR_Pub drPub = new DR_Pub(DCAE_LOCATION_NAME, USERNAME, USRPWD, null, PUB_ID);
+        Entity<DR_Pub> requestedEntity = Entity.entity(drPub, MediaType.APPLICATION_JSON);
+
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .request()
+            .post(requestedEntity, Response.class);
+
+        //then
+        assertEquals(400, resp.getStatus());
+        ApiError responseError = resp.readEntity(ApiError.class);
+        assertNotNull(responseError);
+        assertEquals("feedName", responseError.getFields());
+    }
+
+    @Test
+    public void addDr_Pub_shallReturnError_whenFeedNameProvided_butFeedNotExist() {
+        //given
+        DR_Pub drPub = new DR_Pub(DCAE_LOCATION_NAME, USERNAME, USRPWD, null, PUB_ID);
+        Entity<DR_Pub> requestedEntity = Entity.entity(drPub, MediaType.APPLICATION_JSON);
+        drPub.setFeedName("feed_name");
 
 
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .request()
+            .post(requestedEntity, Response.class);
 
-/*  may conflict with test framework! 
-	@Before
-	public void setUp() throws Exception {
-	}
+        //then
+        assertEquals(404, resp.getStatus());
+        ApiError responseError = resp.readEntity(ApiError.class);
+        assertNotNull(responseError);
+        assertEquals("feedName", responseError.getFields());
 
-	@After
-	public void tearDown() throws Exception {
-	}
-*/
+    }
 
-	private Feed addFeed( String name, String desc ) {
-		Feed feed = new Feed( name, "1.0", desc, "dgl", "unrestricted" );
-		Entity<Feed> reqEntity = Entity.entity( feed, MediaType.APPLICATION_JSON );
-		Response resp = target( "feeds").request().post( reqEntity, Response.class );
-		int rc = resp.getStatus();
-		System.out.println( "POST feed resp=" + rc );
-		assertTrue( rc == 200 || rc == 409 );
-		feed = resp.readEntity( Feed.class );
-		return feed;
-	}
-	
-	private DR_Pub addPub( String d, String un, String up, String feedId ) {
-		DR_Pub dr_pub = new DR_Pub( d, un, up, feedId, "" );
-		Entity<DR_Pub> reqEntity2 = Entity.entity( dr_pub, MediaType.APPLICATION_JSON);
-		Response resp = target( "dr_pubs").request().post( reqEntity2, Response.class);
-		System.out.println( "POST dr_pubs resp=" + resp.getStatus() );
-		assertTrue( resp.getStatus() == 201 );
-		dr_pub = resp.readEntity( DR_Pub.class );
-		
-		return dr_pub;
-	}
-	
-	private DR_Pub addPubByName( String d, String un, String up, String feedName) {
-		DR_Pub dr_pub = new DR_Pub( d, un, up, null, "" );
-		dr_pub.setFeedName(feedName);
-		Entity<DR_Pub> reqEntity2 = Entity.entity( dr_pub, MediaType.APPLICATION_JSON);
-		Response resp = target( "dr_pubs").request().post( reqEntity2, Response.class);
-		System.out.println( "POST dr_pubs resp=" + resp.getStatus() );
-		assertTrue( resp.getStatus() == 201 );
-		dr_pub = resp.readEntity( DR_Pub.class );
-		
-		return dr_pub;
-	}
-	
-	@Test
-	public void GetTest() {
-		Response resp = target( "dr_pubs").request().get( Response.class );
-		System.out.println( "GET dr_pubs resp=" + resp.getStatus() );
+    @Test
+    public void addDr_Pub_shallReturnError_whenFeedIdProvided_butFeedNotExist() {
+        //given
+        DR_Pub drPub = new DR_Pub(DCAE_LOCATION_NAME, USERNAME, USRPWD, FEED_ID, PUB_ID);
+        Entity<DR_Pub> requestedEntity = Entity.entity(drPub, MediaType.APPLICATION_JSON);
 
-		assertTrue( resp.getStatus() == 200 );
-	}
-	
-	@Test
-	public void PostTest() {
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .request()
+            .post(requestedEntity, Response.class);
 
-		Feed feed = addFeed( "pubPostTest", "post unit test" );
-		System.out.println( "fpubPostTest: feedId=" + feed.getFeedId());
-		
-		String d, un, up;
-		d = "central-onap";
-		un = "user1";
-		up = "secretW0rd";
+        //then
+        assertEquals(404, resp.getStatus());
+        ApiError responseError = resp.readEntity(ApiError.class);
+        assertNotNull(responseError);
+        assertEquals("feedId=" + FEED_ID, responseError.getFields());
+    }
 
-		DR_Pub dr_pub = addPub( d, un, up, feed.getFeedId() );
-	}
-	
-	@Test
-	public void PostTestByName() {
+    @Test
+    public void addDr_Pub_shallExecuteSuccessfully_whenValidFeedIdProvided() {
+        //given
+        String feedId = assureFeedIsInDB();
+        DR_Pub drPub = new DR_Pub(DCAE_LOCATION_NAME, USERNAME, USRPWD, feedId);
+        Entity<DR_Pub> requestedEntity = Entity.entity(drPub, MediaType.APPLICATION_JSON);
 
-		Feed feed = addFeed( "pubPostTest2", "post unit test" );
-		System.out.println( "fpubPostTest: feedId=" + feed.getFeedId());
-		
-		String d, un, up;
-		d = "central-onap";
-		un = "user1";
-		up = "secretW0rd";
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .request()
+            .post(requestedEntity, Response.class);
 
-		DR_Pub dr_pub = addPubByName( d, un, up, "pubPostTest2" );	
-	}
+        //then
+        assertEquals(201, resp.getStatus());
+    }
 
-	@Test
-	public void PutTest() {
+    @Test
+    public void addDr_Pub_shallExecuteSuccessfully_whenValidFeedNameProvided() {
+        //given
+        String feedName = "testFeed";
+        testFeedCreator.addFeed(feedName, "test feed");
+        DR_Pub drPub = new DR_Pub(DCAE_LOCATION_NAME, USERNAME, USRPWD, null, PUB_ID);
+        drPub.setFeedName(feedName);
+        Entity<DR_Pub> requestedEntity = Entity.entity(drPub, MediaType.APPLICATION_JSON);
 
-		Feed feed = addFeed( "pubPutTest", "put unit test");
-		String d, un, up;
-		d = "central-onap";
-		un = "user1";
-		up = "secretW0rd";
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .request()
+            .post(requestedEntity, Response.class);
 
-		DR_Pub dr_pub = addPub( d, un, up, feed.getFeedId() );
-		
-		dr_pub.setUserpwd("newSecret");
-		Entity<DR_Pub> reqEntity2 = Entity.entity( dr_pub, MediaType.APPLICATION_JSON);
-		Response resp = target( "dr_pubs")
-				.path( dr_pub.getPubId() )
-				.request()
-				.put( reqEntity2, Response.class);
-		System.out.println( "PUT dr_pubs resp=" + resp.getStatus() );
-		assertTrue( resp.getStatus() == 200 );
-	}
-		
+        //then
+        assertEquals(201, resp.getStatus());
+    }
 
+    @Test
+    public void updateDr_Pub_shallExecuteSuccessfully_whenAddingNewPublisher() {
+        //given
+        String pubId = "5";
+        DR_Pub drPub = new DR_Pub(DCAE_LOCATION_NAME, USERNAME, USRPWD, "feedId", PUB_ID);
+        Entity<DR_Pub> reqEntity2 = Entity.entity(drPub, MediaType.APPLICATION_JSON);
 
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .path(pubId)
+            .request()
+            .put(reqEntity2, Response.class);
+
+        //then
+        assertEquals(200, resp.getStatus());
+
+    }
+
+    @Test
+    public void updateDr_Pub_shallReturnError_whenPathIsWrong() {
+        //given
+        DR_Pub drPub = new DR_Pub(DCAE_LOCATION_NAME, USERNAME, USRPWD, FEED_ID, PUB_ID);
+        Entity<DR_Pub> reqEntity2 = Entity.entity(drPub, MediaType.APPLICATION_JSON);
+
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .path("")
+            .request()
+            .put(reqEntity2, Response.class);
+
+        //then
+        assertEquals(405, resp.getStatus());
+    }
+
+    @Test
+    public void deleteDr_Pub_shouldDeleteObjectWithSuccess() {
+        //given
+        String feedId = assureFeedIsInDB();
+        DR_Pub dr_pub = addPub(DCAE_LOCATION_NAME, USERNAME, USRPWD, feedId);
+
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .path(dr_pub.getPubId())
+            .request()
+            .delete();
+
+        //then
+        assertEquals("Shall delete subscription with success", 204, resp.getStatus());
+        assertFalse("No entity object shall be returned", resp.hasEntity());
+    }
+
+    @Test
+    public void deleteDr_Pub_shouldReturnErrorResponse_whenGivenPubIdNotFound() {
+        //given
+        String notExistingPubId = "6789";
+
+        //when
+        Response resp = testContainer.target("dr_pubs")
+            .path(notExistingPubId)
+            .request()
+            .delete();
+
+        //then
+        assertEquals("Shall return error, when trying to delete not existing subscription", 404, resp.getStatus());
+        ApiError responseError = resp.readEntity(ApiError.class);
+        assertNotNull(responseError);
+        assertEquals("pubId", responseError.getFields());
+    }
+
+    @Test
+    public void get_shallReturnExistingObject() {
+        //given
+        String feedId = assureFeedIsInDB();
+        DR_Pub dr_Pub = addPub(DCAE_LOCATION_NAME, USERNAME, USRPWD, feedId);
+
+        //when
+        Response resp = testContainer.target("dr_pubs")
+                .path(dr_Pub.getPubId())
+                .request()
+                .get();
+
+        //then
+        assertEquals("Subscription shall be found", 200, resp.getStatus());
+        assertEquals("Retrieved object shall be equal to eh one put into DB", dr_Pub, resp.readEntity(DR_Pub.class));
+    }
+
+    private DR_Pub addPub(String d, String un, String up, String feedId) {
+        DR_Pub dr_pub = new DR_Pub(d, un, up, feedId, "");
+        Entity<DR_Pub> reqEntity2 = Entity.entity(dr_pub, MediaType.APPLICATION_JSON);
+        Response resp = testContainer.target("dr_pubs").request().post(reqEntity2, Response.class);
+        System.out.println("POST dr_pubs resp=" + resp.getStatus());
+        assertTrue(resp.getStatus() == 201);
+        dr_pub = resp.readEntity(DR_Pub.class);
+        return dr_pub;
+    }
+
+    private String assureFeedIsInDB() {
+        Feed feed = testFeedCreator.addFeed("SubscriberTestFeed", "feed for DR_Sub testing");
+        assertNotNull("Feed shall be added into DB properly", feed);
+        return feed.getFeedId();
+    }
 }
 
 
diff --git a/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java b/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java
index f812b3d..13b89ea 100644
--- a/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java
+++ b/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java
@@ -50,6 +50,7 @@
     private static final String DELIVERY_URL_TEMPLATE = "https://subscriber.onap.org/delivery/";
     private static final String LOG_URL_TEMPLATE = "https://dr-prov/sublog/";
     private static FastJerseyTestContainer testContainer;
+    private static TestFeedCreator testFeedCreator;
 
     @BeforeClass
     public static void setUpClass() throws Exception {
@@ -60,6 +61,7 @@
             .register(DR_SubResource.class)
             .register(FeedResource.class));
         testContainer.init();
+        testFeedCreator = new TestFeedCreator(testContainer);
     }
 
     @AfterClass
@@ -189,7 +191,7 @@
     public void addDr_Sub_shallExecuteSuccessfully_whenValidFeedNameProvided() {
         //given
         String feedName = "testFeed";
-        addFeed(feedName, "test feed");
+        testFeedCreator.addFeed(feedName, "test feed");
         DR_Sub drSub = new DR_Sub(DCAE_LOCATION_NAME, USERNAME, USRPWD, null, DELIVERY_URL, LOG_URL, true);
         drSub.setFeedName(feedName);
         Entity<DR_Sub> requestedEntity = Entity.entity(drSub, MediaType.APPLICATION_JSON);
@@ -390,17 +392,6 @@
         assertNotNull(resp.readEntity(ApiError.class));
     }
 
-    private Feed addFeed(String name, String desc) {
-        Feed feed = new Feed(name, "1.0", desc, "dgl", "unrestricted");
-        Entity<Feed> reqEntity = Entity.entity(feed, MediaType.APPLICATION_JSON);
-        Response resp = testContainer.target("feeds").request().post(reqEntity, Response.class);
-        int rc = resp.getStatus();
-        System.out.println("POST feed resp=" + rc);
-        assertTrue(rc == 200 || rc == 409);
-        feed = resp.readEntity(Feed.class);
-        return feed;
-    }
-
     private DR_Sub addSub(String d, String un, String up, String feedId) {
         DR_Sub dr_sub = new DR_Sub(d, un, up, feedId,
             "https://subscriber.onap.org/foo", "https://dr-prov/sublog", true);
@@ -415,7 +406,7 @@
     }
 
     private String assureFeedIsInDB() {
-        Feed feed = addFeed("SubscriberTestFeed", "feed for DR_Sub testing");
+        Feed feed = testFeedCreator.addFeed("SubscriberTestFeed", "feed for DR_Sub testing");
         assertNotNull("Feed shall be added into DB properly", feed);
         return feed.getFeedId();
     }
diff --git a/src/test/java/org/onap/dmaap/dbcapi/resources/TestFeedCreator.java b/src/test/java/org/onap/dmaap/dbcapi/resources/TestFeedCreator.java
new file mode 100644
index 0000000..e4dedb1
--- /dev/null
+++ b/src/test/java/org/onap/dmaap/dbcapi/resources/TestFeedCreator.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.onap.dmaap
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.dmaap.dbcapi.resources;
+
+import static org.junit.Assert.assertTrue;
+
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.dmaap.dbcapi.model.Feed;
+
+
+public class TestFeedCreator {
+
+
+    private final FastJerseyTestContainer testContainer;
+
+    public TestFeedCreator(FastJerseyTestContainer testContainer) {
+        this.testContainer = testContainer;
+    }
+
+    Feed addFeed(String name, String desc) {
+        Feed feed = new Feed(name, "1.0", desc, "dgl", "unrestricted");
+        Entity<Feed> reqEntity = Entity.entity(feed, MediaType.APPLICATION_JSON);
+        Response resp = testContainer.target("feeds").request().post(reqEntity, Response.class);
+        int rc = resp.getStatus();
+        System.out.println("POST feed resp=" + rc);
+        assertTrue(rc == 200 || rc == 409);
+        feed = resp.readEntity(Feed.class);
+        return feed;
+    }
+}
