From 38c9e770cb49504b90de40bb29f4fb4ec908fc32 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Wed, 24 Jul 2019 19:50:02 +0200
Subject: [PATCH] instead catching exception inform junit to expect it

---
 .../annotation/cache/BigFileCacheTest.java    |  73 ++++-----
 .../annotation/cache/GeneralCacheTest.java    |  45 ++----
 .../cache/GeneralCacheWithExclusionTest.java  |   9 +-
 .../PermanentDatabaseLevelCacheTest.java      |  16 +-
 .../cache/WebPageDownloaderTest.java          | 147 ++++++++----------
 .../mapviewer/annotation/data/TargetTest.java |  11 +-
 .../services/ChemicalParserTest.java          |   8 +-
 .../services/DrugbankHTMLParserTest.java      |   1 -
 .../services/ImproperAnnotationsTest.java     |  71 ++++-----
 .../annotation/services/MiRNAParserTest.java  |   9 +-
 .../services/TaxonomyBackendTest.java         |   4 +-
 .../annotators/ChebiAnnotatorTest.java        |  37 +----
 .../annotators/ElementAnnotatorTest.java      |  59 +++----
 .../annotators/EnsemblAnnotatorTest.java      |   4 +-
 .../annotators/EntrezAnnotatorTest.java       | 146 ++++++++---------
 .../services/annotators/GoAnnotatorTest.java  |  25 ++-
 .../annotators/UniprotAnnotatorTest.java      |   4 +-
 .../UcscReferenceGenomeConnectorTest.java     |  40 ++---
 .../mapviewer/common/ObjectUtilsTest.java     |  83 +++++-----
 .../lcsb/mapviewer/common/XmlParserTest.java  |   2 -
 .../common/geometry/ColorParserTest.java      |   2 -
 .../celldesigner/LayerXmlParserTest.java      |   1 -
 .../CellDesignerAliasConverterTest.java       |  67 ++++----
 ...ProteinCellDesignerAliasConverterTest.java |  37 ++---
 ...oleculeCellDesignerAliasConverterTest.java |  21 +--
 ...CellDesignerPolygonTransformationTest.java | 102 +++++-------
 .../reaction/ReactionToXmlTest.java           |  52 ++-----
 .../species/InternalModelSpeciesDataTest.java |  73 ++++-----
 .../structure/ModificationResidueTest.java    |  23 +--
 .../structure/SpeciesStateTest.java           |  21 +--
 .../celldesigner/structure/SpeciesTest.java   |  54 ++++---
 .../converter/ComplexZipConverterTest.java    |  54 ++-----
 .../mapviewer/commands/CopyCommandTest.java   |   8 +-
 .../commands/CreateHierarchyCommandTest.java  |   9 +-
 .../map/compartment/CompartmentTest.java      |  35 +++--
 .../map/layout/graphics/LayerOvalTest.java    |  44 +++---
 .../map/layout/graphics/LayerRectTest.java    |  46 +++---
 .../map/layout/graphics/LayerTextTest.java    |  55 ++++---
 .../model/map/model/ModelComparatorTest.java  |  17 +-
 .../model/map/species/ElementTest.java        |  22 +--
 .../map/species/field/StructureTest.java      | 101 ++++++------
 .../map/species/field/UniprotRecordTest.java  |  88 +++++------
 .../map/statistics/SearchHistoryDaoTest.java  |  28 ++--
 43 files changed, 698 insertions(+), 1056 deletions(-)

diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/BigFileCacheTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/BigFileCacheTest.java
index c6cc03d374..0e0b7f5305 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/BigFileCacheTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/BigFileCacheTest.java
@@ -136,7 +136,7 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
     bigFileCache.isLocalFileUpToDate(httpUrl + "?some_get_param");
   }
 
-  @Test
+  @Test(expected = FileNotFoundException.class)
   public void testIsLocalHttpFileUpToDateWhenFileRemovedManually() throws Exception {
     bigFileCache.downloadFile(httpUrl, false, new IProgressUpdater() {
       @Override
@@ -146,10 +146,9 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
     new File(bigFileCache.getAbsolutePathForFile(httpUrl)).delete();
     try {
       bigFileCache.isLocalFileUpToDate(httpUrl);
-      fail("Exception expected");
-    } catch (FileNotFoundException e) {
+    } finally {
+      bigFileCache.removeFile(httpUrl);
     }
-    bigFileCache.removeFile(httpUrl);
   }
 
   @Test(expected = FileNotFoundException.class)
@@ -157,7 +156,7 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
     bigFileCache.isLocalFileUpToDate(ftpUrl);
   }
 
-  @Test
+  @Test(expected = IOException.class)
   public void testRefreshCacheQueryWhenFtpConnectionFails() throws Exception {
 
     try {
@@ -183,16 +182,13 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
       bigFileCache.setFtpClientFactory(factory);
 
       bigFileCache.isLocalFileUpToDate(ftpUrl);
-      fail("Exception expected");
-    } catch (IOException e) {
-      assertTrue(e.getMessage().contains("FTP server refused connection"));
     } finally {
       bigFileCache.setFtpClientFactory(new FtpClientFactory());
       bigFileCache.removeFile(ftpUrl);
     }
   }
 
-  @Test
+  @Test(expected = IOException.class)
   public void testDownloadWhenFtpConnectionFails() throws Exception {
     try {
       FTPClient mockClient = Mockito.mock(FTPClient.class);
@@ -208,10 +204,6 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
 
       bigFileCache.setFtpClientFactory(factory);
       bigFileCache.downloadFile(ftpUrl, false, null);
-
-      fail("Exception expected");
-    } catch (IOException e) {
-      assertTrue(e.getMessage().contains("FTP server refused connection"));
     } finally {
       bigFileCache.setFtpClientFactory(new FtpClientFactory());
       bigFileCache.removeFile(ftpUrl);
@@ -233,7 +225,7 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = FileNotFoundException.class)
   public void testDownloadedFileRemovedException() throws Exception {
     String url = ftpUrl;
     bigFileCache.downloadFile(url, false, new IProgressUpdater() {
@@ -248,25 +240,36 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
 
     try {
       bigFileCache.getAbsolutePathForFile(url);
-      fail("Exception expected");
-    } catch (FileNotFoundException e) {
-
+    } finally {
+      bigFileCache.removeFile(url);
+      assertNull(bigFileCache.getAbsolutePathForFile(url));
+      assertFalse(f.exists());
     }
+  }
+
+  @Test(expected = FileNotFoundException.class)
+  public void testDownloadedFileRemovedException2() throws Exception {
+    String url = ftpUrl;
+    bigFileCache.downloadFile(url, false, new IProgressUpdater() {
+      @Override
+      public void setProgress(double progress) {
+      }
+    });
+    String localFile = bigFileCache.getAbsolutePathForFile(url);
+    File f = new File(localFile);
+    assertTrue(f.exists());
+    f.delete();
+
     try {
       bigFileCache.isLocalFileUpToDate(url);
-      fail("Exception expected");
-    } catch (FileNotFoundException e) {
-
+    } finally {
+      bigFileCache.removeFile(url);
+      assertNull(bigFileCache.getAbsolutePathForFile(url));
+      assertFalse(f.exists());
     }
-
-    bigFileCache.removeFile(url);
-
-    assertNull(bigFileCache.getAbsolutePathForFile(url));
-
-    assertFalse(f.exists());
   }
 
-  @Test
+  @Test(expected = FileNotFoundException.class)
   public void testGetPathForFileBeingDownloaded() throws Exception {
     String url = ftpUrl;
     BigFileCache bigFileCacheUnderTest = new BigFileCache(null, null, null);
@@ -275,12 +278,7 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
     when(mockDao.getByUrl(anyString())).thenReturn(entry);
 
     bigFileCacheUnderTest.setBigFileEntryDao(mockDao);
-    try {
-      bigFileCacheUnderTest.getAbsolutePathForFile(url);
-      fail("Exception expected");
-    } catch (FileNotFoundException e) {
-      assertTrue(e.getMessage().contains("File is not complete"));
-    }
+    bigFileCacheUnderTest.getAbsolutePathForFile(url);
   }
 
   @Test
@@ -386,14 +384,9 @@ public class BigFileCacheTest extends AnnotationTestFunctions {
     bigFileCache.removeFile("unexisting file");
   }
 
-  @Test
+  @Test(expected = URISyntaxException.class)
   public void testIsLocalFileUpToDateForInvalidURI() throws Exception {
-    try {
-      bigFileCache.isLocalFileUpToDate("unexistingFileProtocol://bla");
-      fail("Exception expected");
-    } catch (URISyntaxException e) {
-      assertTrue(e.getMessage().contains("Unknown protocol"));
-    }
+    bigFileCache.isLocalFileUpToDate("unexistingFileProtocol://bla");
   }
 
   @Test
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/GeneralCacheTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/GeneralCacheTest.java
index 93580d0ef1..6f44000671 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/GeneralCacheTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/GeneralCacheTest.java
@@ -48,54 +48,29 @@ public class GeneralCacheTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testGetXmlNodeByQueryForInvalidType() {
-    try {
-      cache.getXmlNodeByQuery("str", null);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Cache type cannot be null"));
-    }
+    cache.getXmlNodeByQuery("str", null);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testSetCachedQueryForInvalidType() {
-    try {
-      cache.setCachedQuery("str", null, null);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Cache type cannot be null"));
-    }
+    cache.setCachedQuery("str", null, null);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testRemoveByQueryForInvalidType() {
-    try {
-      cache.removeByQuery("str", null);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Cache type cannot be null"));
-    }
+    cache.removeByQuery("str", null);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testInvalidateByQueryForInvalidType() {
-    try {
-      cache.invalidateByQuery("str", null);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Cache type cannot be null"));
-    }
+    cache.invalidateByQuery("str", null);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testGetStringByQueryForInvalidType() {
-    try {
-      cache.getStringByQuery("str", null);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Cache type cannot be null"));
-    }
+    cache.getStringByQuery("str", null);
   }
 
   @Test
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/GeneralCacheWithExclusionTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/GeneralCacheWithExclusionTest.java
index d7e71db3a8..57a077c675 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/GeneralCacheWithExclusionTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/GeneralCacheWithExclusionTest.java
@@ -25,14 +25,9 @@ public class GeneralCacheWithExclusionTest extends AnnotationTestFunctions {
   public void tearDown() throws Exception {
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testConstructorWithInvalidParams() {
-    try {
-      new GeneralCacheWithExclusion(null, 1);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Cache passed as argument cannot be null"));
-    }
+    new GeneralCacheWithExclusion(null, 1);
   }
 
   @Test
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/PermanentDatabaseLevelCacheTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/PermanentDatabaseLevelCacheTest.java
index 9bd29364a1..a20da355c6 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/PermanentDatabaseLevelCacheTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/PermanentDatabaseLevelCacheTest.java
@@ -67,20 +67,14 @@ public class PermanentDatabaseLevelCacheTest extends AnnotationTestFunctions {
     assertEquals("hello23", node.getNodeName());
   }
 
-  @Test
+  @Test(expected = CacheException.class)
   public void testSetInvalidQuery() {
-    try {
-      String query = "blabla";
-      Object object = new Object();
-
-      CacheType type = cacheTypeDao.getByClassName(PubmedParser.class.getCanonicalName());
+    String query = "blabla";
+    Object object = new Object();
 
-      cache.setCachedQuery(query, type, object);
-      fail("Exception expected");
+    CacheType type = cacheTypeDao.getByClassName(PubmedParser.class.getCanonicalName());
 
-    } catch (CacheException e) {
-      assertTrue(e.getMessage().contains("Unknown object type"));
-    }
+    cache.setCachedQuery(query, type, object);
   }
 
   @Test
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/WebPageDownloaderTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/WebPageDownloaderTest.java
index 65c6fb5f67..ab41debd38 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/cache/WebPageDownloaderTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/cache/WebPageDownloaderTest.java
@@ -1,98 +1,83 @@
 package lcsb.mapviewer.annotation.cache;
 
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.UnknownHostException;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 import org.mockito.Mockito;
 
 public class WebPageDownloaderTest {
 
-	@AfterClass
-	public static void tearDownAfterClass() throws Exception {
-	}
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+  }
 
-	@Before
-	public void setUp() throws Exception {
-	}
+  @Before
+  public void setUp() throws Exception {
+  }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+  @After
+  public void tearDown() throws Exception {
+  }
 
-	@Test
-	public void testConnectionProblems() {
-		WebPageDownloader downloader = new WebPageDownloader() {
-			@Override
-			public HttpURLConnection openConnection(String url) throws IOException {
-				HttpURLConnection result = Mockito.mock(HttpURLConnection.class);
-				Mockito.doReturn(HttpURLConnection.HTTP_INTERNAL_ERROR).when(result).getResponseCode();
-				Mockito.doThrow(new IOException()).when(result).getInputStream();
-				return result;
-			}
-		};
-		try {
-			downloader.getFromNetwork("https://www.google.pl/?gws_rd=ssl");
-			fail("Exceptio expected");
-		} catch (IOException e) {
-		}
-	}
+  @Test(expected = IOException.class)
+  public void testConnectionProblems() throws IOException {
+    WebPageDownloader downloader = new WebPageDownloader() {
+      @Override
+      public HttpURLConnection openConnection(String url) throws IOException {
+        HttpURLConnection result = Mockito.mock(HttpURLConnection.class);
+        Mockito.doReturn(HttpURLConnection.HTTP_INTERNAL_ERROR).when(result).getResponseCode();
+        Mockito.doThrow(new IOException()).when(result).getInputStream();
+        return result;
+      }
+    };
+    downloader.getFromNetwork("https://www.google.pl/?gws_rd=ssl");
+  }
 
-	@Test
-	public void testConnectionProblems2() {
-		WebPageDownloader downloader = new WebPageDownloader() {
-			@Override
-			public HttpURLConnection openConnection(String url) throws IOException {
-				HttpURLConnection result = Mockito.mock(HttpURLConnection.class);
-				Mockito.doReturn(HttpURLConnection.HTTP_OK).when(result).getResponseCode();
-				Mockito.doThrow(new UnknownHostException()).when(result).getInputStream();
-				return result;
-			}
-		};
-		try {
-			downloader.getFromNetwork("https://www.google.pl/?gws_rd=ssl");
-			fail("Exceptio expected");
-		} catch (IOException e) {
-		}
-	}
-	
-	@Test
-	public void testSend1() {
-		WebPageDownloader downloader = new WebPageDownloader();
-		try {
-		String result = downloader.getFromNetwork("https://www.google.com/");
-		assertNotNull("GET request to Google should return non-null result", result);
-		} catch (IOException e) {
-		}
-	}
-	
-	@Test
-	public void testPost1() {
-		WebPageDownloader downloader = new WebPageDownloader();
-		try {
-		String result = downloader.getFromNetwork("https://www.ebi.ac.uk/pdbe/api/mappings/best_structures/", "POST", "P29373");
-		assertNotNull("POST request to Uniprot should return non-null result", result);
-		} catch (IOException e) {
-		}
-		
-	}
-	
-	@Test
-	public void testInvalidHttpRequestType() {
-		WebPageDownloader downloader = new WebPageDownloader();
-		try {
-		downloader.getFromNetwork("https://www.ebi.ac.uk/pdbe/api/mappings/best_structures/", "XXX", "P29373");
-		fail("Invalid request exception expected");
-		} catch (IOException e) {
-		}
-		
-	}
+  @Test(expected = IOException.class)
+  public void testConnectionProblems2() throws IOException {
+    WebPageDownloader downloader = new WebPageDownloader() {
+      @Override
+      public HttpURLConnection openConnection(String url) throws IOException {
+        HttpURLConnection result = Mockito.mock(HttpURLConnection.class);
+        Mockito.doReturn(HttpURLConnection.HTTP_OK).when(result).getResponseCode();
+        Mockito.doThrow(new UnknownHostException()).when(result).getInputStream();
+        return result;
+      }
+    };
+    downloader.getFromNetwork("https://www.google.pl/?gws_rd=ssl");
+  }
+
+  @Test
+  public void testSend1() {
+    WebPageDownloader downloader = new WebPageDownloader();
+    try {
+      String result = downloader.getFromNetwork("https://www.google.com/");
+      assertNotNull("GET request to Google should return non-null result", result);
+    } catch (IOException e) {
+    }
+  }
+
+  @Test
+  public void testPost1() {
+    WebPageDownloader downloader = new WebPageDownloader();
+    try {
+      String result = downloader.getFromNetwork("https://www.ebi.ac.uk/pdbe/api/mappings/best_structures/", "POST",
+          "P29373");
+      assertNotNull("POST request to Uniprot should return non-null result", result);
+    } catch (IOException e) {
+    }
+
+  }
+
+  @Test(expected = IOException.class)
+  public void testInvalidHttpRequestType() throws IOException {
+    WebPageDownloader downloader = new WebPageDownloader();
+    downloader.getFromNetwork("https://www.ebi.ac.uk/pdbe/api/mappings/best_structures/", "XXX", "P29373");
+
+  }
 
 }
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/data/TargetTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/data/TargetTest.java
index aae2ffd69b..c1f4d752ac 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/data/TargetTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/data/TargetTest.java
@@ -36,14 +36,9 @@ public class TargetTest extends AnnotationTestFunctions {
     assertEquals(genes, target.getGenes());
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testAddInvalidGene() {
-    try {
-      Target target = new Target();
-      target.addGene(null);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Cannot add null element"));
-    }
+    Target target = new Target();
+    target.addGene(null);
   }
 }
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
index 3718f63554..bb82811c85 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
@@ -370,7 +370,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = ChemicalSearchException.class)
   public void testProblemWithPubmeds() throws Exception {
     GeneralCacheInterface cache = chemicalParser.getCache();
     WebPageDownloader downloader = chemicalParser.getWebPageDownloader();
@@ -393,11 +393,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
       when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class)))
           .thenThrow(new IOException());
       chemicalParser.setWebPageDownloader(mockDownloader);
-      try {
-        chemicalParser.getChemicals(parkinsonDiseaseId, idsList);
-        fail("Exception expected");
-      } catch (ChemicalSearchException e) {
-      }
+      chemicalParser.getChemicals(parkinsonDiseaseId, idsList);
     } finally {
       chemicalParser.setCache(cache);
       chemicalParser.setWebPageDownloader(downloader);
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/DrugbankHTMLParserTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/DrugbankHTMLParserTest.java
index e6daa784e4..e5e204064e 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/DrugbankHTMLParserTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/DrugbankHTMLParserTest.java
@@ -226,7 +226,6 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
   @Test(expected = InvalidArgumentException.class)
   public void testFindDrugByInvalidTarget() throws Exception {
     drugBankHTMLParser.getDrugListByTarget(new MiriamData(MiriamType.WIKIPEDIA, "h2o"));
-    fail("Exception");
   }
 
   @Test
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ImproperAnnotationsTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ImproperAnnotationsTest.java
index 2af983bf77..b7316ecc36 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ImproperAnnotationsTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ImproperAnnotationsTest.java
@@ -1,56 +1,43 @@
 package lcsb.mapviewer.annotation.services;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 
+import lcsb.mapviewer.annotation.AnnotationTestFunctions;
 import lcsb.mapviewer.common.exception.InvalidArgumentException;
 import lcsb.mapviewer.model.map.MiriamData;
 import lcsb.mapviewer.model.map.MiriamType;
 import lcsb.mapviewer.model.map.species.GenericProtein;
 
-public class ImproperAnnotationsTest {
-
-	@AfterClass
-	public static void tearDownAfterClass() throws Exception {
-	}
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testConstructor3() {
-		try {
-			List<MiriamData> list = new ArrayList<>();
-			list.add(new MiriamData(MiriamType.CAS, "a"));
-			ImproperAnnotations ie = new ImproperAnnotations(new GenericProtein("id"), list);
-			assertNotNull(ie.toString());
-		} catch (InvalidArgumentException e) {
-			assertTrue(e.getMessage().contains("Only miriam data from elements are accepted"));
-		}
-	}
-
-	@Test
-	public void testConstructor4() {
-		try {
-			new ImproperAnnotations(new GenericProtein("id"), new ArrayList<>());
-			fail("Exception expected");
-		} catch (InvalidArgumentException e) {
-			assertTrue(e.getMessage().contains("List of improper annotations cannot be null"));
-		}
-	}
+public class ImproperAnnotationsTest extends AnnotationTestFunctions {
+
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+  }
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test
+  public void testConstructor3() {
+    List<MiriamData> list = new ArrayList<>();
+    list.add(new MiriamData(MiriamType.CAS, "a"));
+    ImproperAnnotations ie = new ImproperAnnotations(new GenericProtein("id"), list);
+    assertNotNull(ie.toString());
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testConstructor4() {
+    new ImproperAnnotations(new GenericProtein("id"), new ArrayList<>());
+  }
 
 }
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/MiRNAParserTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/MiRNAParserTest.java
index d057f9470c..ba35eb5f63 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/MiRNAParserTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/MiRNAParserTest.java
@@ -70,7 +70,7 @@ public class MiRNAParserTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = MiRNASearchException.class)
   public void testFindWhenProblemWithTaxonomy() throws Exception {
     TaxonomyBackend taxonomyBackend = miRNAParser.getTaxonomyBackend();
     GeneralCacheInterface cache = miRNAParser.getCache();
@@ -81,12 +81,7 @@ public class MiRNAParserTest extends AnnotationTestFunctions {
       TaxonomyBackend backend = Mockito.mock(TaxonomyBackend.class);
       when(backend.getByName(anyString())).thenThrow(new TaxonomySearchException(null, null));
       miRNAParser.setTaxonomyBackend(backend);
-      try {
-        miRNAParser.getMiRnasByNames(names);
-        fail("Exception expected");
-      } catch (MiRNASearchException e) {
-
-      }
+      miRNAParser.getMiRnasByNames(names);
     } finally {
       miRNAParser.setCache(cache);
       miRNAParser.setTaxonomyBackend(taxonomyBackend);
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/TaxonomyBackendTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/TaxonomyBackendTest.java
index 2e69c4b1d8..6c90220d69 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/TaxonomyBackendTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/TaxonomyBackendTest.java
@@ -70,7 +70,7 @@ public class TaxonomyBackendTest extends AnnotationTestFunctions {
     assertNotNull(taxonomyBackend.getNameForTaxonomy(new MiriamData(MiriamType.TAXONOMY, "9605")));
   }
 
-  @Test
+  @Test(expected = TaxonomySearchException.class)
   public void testGetNameWhenProblemWithDb() throws Exception {
     WebPageDownloader downloader = taxonomyBackend.getWebPageDownloader();
     try {
@@ -80,8 +80,6 @@ public class TaxonomyBackendTest extends AnnotationTestFunctions {
       taxonomyBackend.setWebPageDownloader(mockDownloader);
       taxonomyBackend.setCache(null);
       taxonomyBackend.getNameForTaxonomy(new MiriamData(MiriamType.TAXONOMY, "9606"));
-      fail("Exception expected");
-    } catch (TaxonomySearchException e) {
     } finally {
       taxonomyBackend.setCache(cache);
       taxonomyBackend.setWebPageDownloader(downloader);
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotatorTest.java
index 6fe5b2d8f9..4af51cf203 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotatorTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotatorTest.java
@@ -71,7 +71,7 @@ public class ChebiAnnotatorTest extends AnnotationTestFunctions {
     assertEquals("Nc1ncnc2[nH]cnc12", chebi.getSmiles());
   }
 
-  @Test
+  @Test(expected = ChebiSearchException.class)
   public void testChebiByIdWhenConnectionFails() throws Exception {
     try {
       cache = backend.getCache();
@@ -94,10 +94,6 @@ public class ChebiAnnotatorTest extends AnnotationTestFunctions {
       backend.setClient(chebiWebServiceClient);
 
       backend.getChebiElementForChebiId(new MiriamData(MiriamType.CHEBI, "CHEBI:16708"));
-      fail("Exception expected");
-
-    } catch (ChebiSearchException e) {
-      assertTrue(e.getMessage().contains("Problem with chebi"));
     } finally {
       // restore cache for other tests
       backend.setCache(cache);
@@ -236,7 +232,7 @@ public class ChebiAnnotatorTest extends AnnotationTestFunctions {
     assertFalse(simpleMolecule.getSynonyms().size() == 0);
   }
 
-  @Test
+  @Test(expected = AnnotatorException.class)
   public void testAnnotateWhenConnectionFails() throws Exception {
     try {
       SimpleMolecule simpleMolecule = new SimpleMolecule("id");
@@ -260,10 +256,6 @@ public class ChebiAnnotatorTest extends AnnotationTestFunctions {
 
       backend.setCache(null);
       backend.annotateElement(simpleMolecule);
-
-      fail("Exception expected");
-    } catch (AnnotatorException e) {
-      assertTrue(e.getMessage().contains("Problem with getting information about chebi"));
     } finally {
       backend.setCache(cache);
       backend.setClient(null);
@@ -564,7 +556,7 @@ public class ChebiAnnotatorTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testRefreshWhenProblemWithConnnector() throws Exception {
     cache = backend.getCache();
     try {
@@ -588,9 +580,6 @@ public class ChebiAnnotatorTest extends AnnotationTestFunctions {
 
       String query = ChebiAnnotator.ONTOLOGY_PREFIX + "CHEBI:18009";
       backend.refreshCacheQuery(query);
-      fail("Exception expected");
-
-    } catch (SourceNotAvailable e) {
     } finally {
       // restore cache for other tests
       backend.setCache(cache);
@@ -599,26 +588,14 @@ public class ChebiAnnotatorTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testRefreshInvalidQuery() throws Exception {
-    try {
-      backend.refreshCacheQuery("invalid string");
-
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Don't know what to do"));
-    }
+    backend.refreshCacheQuery("invalid string");
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testRefreshInvalidQuery2() throws Exception {
-    try {
-      backend.refreshCacheQuery(new Object());
-
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Don't know what to do"));
-    }
+    backend.refreshCacheQuery(new Object());
   }
 
   @Test
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java
index 7e10aef006..c2b91fbff5 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java
@@ -1,36 +1,25 @@
 package lcsb.mapviewer.annotation.services.annotators;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.nullable;
-import static org.mockito.Mockito.when;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
 
 import java.io.IOException;
 import java.util.Arrays;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 import org.mockito.Mockito;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import lcsb.mapviewer.annotation.AnnotationTestFunctions;
-import lcsb.mapviewer.annotation.cache.GeneralCacheInterface;
-import lcsb.mapviewer.annotation.cache.SourceNotAvailable;
-import lcsb.mapviewer.annotation.cache.WebPageDownloader;
+import lcsb.mapviewer.annotation.cache.*;
 import lcsb.mapviewer.common.exception.InvalidArgumentException;
 import lcsb.mapviewer.model.map.MiriamData;
 import lcsb.mapviewer.model.map.MiriamType;
 import lcsb.mapviewer.model.map.reaction.Reaction;
 import lcsb.mapviewer.model.map.species.GenericProtein;
 import lcsb.mapviewer.model.map.species.Ion;
-import lcsb.mapviewer.model.user.annotator.AnnotatorData;
-import lcsb.mapviewer.model.user.annotator.AnnotatorOutputParameter;
-import lcsb.mapviewer.model.user.annotator.BioEntityField;
+import lcsb.mapviewer.model.user.annotator.*;
 
 public class ElementAnnotatorTest extends AnnotationTestFunctions {
 
@@ -172,11 +161,11 @@ public class ElementAnnotatorTest extends AnnotationTestFunctions {
 
   @Test
   public void testSetTheSameMcs() throws Exception {
-      Reaction reaction = new Reaction();
-      reaction.setMechanicalConfidenceScore(4);
-      ElementAnnotator.BioEntityProxy proxy = annotator.new BioEntityProxy(reaction, allOutputFieldsAndAnnotations);
-      proxy.setMechanicalConfidenceScore("4");
-      assertEquals(0, getWarnings().size());
+    Reaction reaction = new Reaction();
+    reaction.setMechanicalConfidenceScore(4);
+    ElementAnnotator.BioEntityProxy proxy = annotator.new BioEntityProxy(reaction, allOutputFieldsAndAnnotations);
+    proxy.setMechanicalConfidenceScore("4");
+    assertEquals(0, getWarnings().size());
   }
 
   @Test
@@ -210,31 +199,21 @@ public class ElementAnnotatorTest extends AnnotationTestFunctions {
 
   @Test
   public void testRefreshCacheQuery() throws Exception {
-      Object res = autowiredAnnotator.refreshCacheQuery("http://google.cz/");
-      assertNotNull(res);
+    Object res = autowiredAnnotator.refreshCacheQuery("http://google.cz/");
+    assertNotNull(res);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testRefreshInvalidCacheQuery() throws Exception {
-    try {
-      autowiredAnnotator.refreshCacheQuery("invalid_query");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Don't know what to do"));
-    }
+    autowiredAnnotator.refreshCacheQuery("invalid_query");
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testRefreshInvalidCacheQuery2() throws Exception {
-    try {
-      autowiredAnnotator.refreshCacheQuery(new Object());
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Don't know what to do"));
-    }
+    autowiredAnnotator.refreshCacheQuery(new Object());
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testRefreshCacheQueryNotAvailable() throws Exception {
     WebPageDownloader downloader = autowiredAnnotator.getWebPageDownloader();
     GeneralCacheInterface originalCache = autowiredAnnotator.getCache();
@@ -247,8 +226,6 @@ public class ElementAnnotatorTest extends AnnotationTestFunctions {
           .thenThrow(new IOException());
       autowiredAnnotator.setWebPageDownloader(mockDownloader);
       autowiredAnnotator.refreshCacheQuery("http://google.pl/");
-      fail("Exception expected");
-    } catch (SourceNotAvailable e) {
     } finally {
       autowiredAnnotator.setWebPageDownloader(downloader);
       autowiredAnnotator.setCache(originalCache);
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotatorTest.java
index 8746dd18a5..78a2dd104c 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotatorTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotatorTest.java
@@ -202,7 +202,7 @@ public class EnsemblAnnotatorTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testRefreshCacheQueryNotAvailable() throws Exception {
     WebPageDownloader downloader = ensemblAnnotator.getWebPageDownloader();
     GeneralCacheInterface originalCache = ensemblAnnotator.getCache();
@@ -215,8 +215,6 @@ public class EnsemblAnnotatorTest extends AnnotationTestFunctions {
           .thenThrow(new IOException());
       ensemblAnnotator.setWebPageDownloader(mockDownloader);
       ensemblAnnotator.refreshCacheQuery("http://google.pl/");
-      fail("Exception expected");
-    } catch (SourceNotAvailable e) {
     } finally {
       ensemblAnnotator.setWebPageDownloader(downloader);
       ensemblAnnotator.setCache(originalCache);
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java
index e10b025446..572cfb18a5 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java
@@ -1,29 +1,17 @@
 package lcsb.mapviewer.annotation.services.annotators;
 
-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 static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.nullable;
-import static org.mockito.Mockito.when;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
 
 import java.io.IOException;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 import org.mockito.Mockito;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import lcsb.mapviewer.annotation.AnnotationTestFunctions;
-import lcsb.mapviewer.annotation.cache.GeneralCacheInterface;
-import lcsb.mapviewer.annotation.cache.PermanentDatabaseLevelCacheInterface;
-import lcsb.mapviewer.annotation.cache.SourceNotAvailable;
-import lcsb.mapviewer.annotation.cache.WebPageDownloader;
-import lcsb.mapviewer.annotation.cache.XmlSerializer;
+import lcsb.mapviewer.annotation.cache.*;
 import lcsb.mapviewer.annotation.data.EntrezData;
 import lcsb.mapviewer.annotation.services.ExternalServiceStatusType;
 import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException;
@@ -51,67 +39,67 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
 
   @Test
   public void testGetAnnotationsForEntrezId() throws Exception {
-      MiriamData nsmf = new MiriamData(MiriamType.ENTREZ, "6647");
-      GenericProtein proteinAlias = new GenericProtein("id");
-      proteinAlias.addMiriamData(nsmf);
-      entrezAnnotator.annotateElement(proteinAlias);
-      assertNotNull(proteinAlias.getSymbol());
-      assertNotNull(proteinAlias.getFullName());
-      assertNotNull(proteinAlias.getNotes());
-      assertFalse(proteinAlias.getNotes().isEmpty());
-      assertTrue(proteinAlias.getMiriamData().size() > 1);
-      assertTrue(proteinAlias.getSynonyms().size() > 0);
-
-      boolean ensemble = false;
-      boolean hgncId = false;
-      boolean entrez = false;
-      for (MiriamData md : proteinAlias.getMiriamData()) {
-        if (MiriamType.ENSEMBL.equals(md.getDataType())) {
-          ensemble = true;
-        } else if (MiriamType.HGNC.equals(md.getDataType())) {
-          hgncId = true;
-        } else if (MiriamType.ENTREZ.equals(md.getDataType())) {
-          entrez = true;
-        }
+    MiriamData nsmf = new MiriamData(MiriamType.ENTREZ, "6647");
+    GenericProtein proteinAlias = new GenericProtein("id");
+    proteinAlias.addMiriamData(nsmf);
+    entrezAnnotator.annotateElement(proteinAlias);
+    assertNotNull(proteinAlias.getSymbol());
+    assertNotNull(proteinAlias.getFullName());
+    assertNotNull(proteinAlias.getNotes());
+    assertFalse(proteinAlias.getNotes().isEmpty());
+    assertTrue(proteinAlias.getMiriamData().size() > 1);
+    assertTrue(proteinAlias.getSynonyms().size() > 0);
+
+    boolean ensemble = false;
+    boolean hgncId = false;
+    boolean entrez = false;
+    for (MiriamData md : proteinAlias.getMiriamData()) {
+      if (MiriamType.ENSEMBL.equals(md.getDataType())) {
+        ensemble = true;
+      } else if (MiriamType.HGNC.equals(md.getDataType())) {
+        hgncId = true;
+      } else if (MiriamType.ENTREZ.equals(md.getDataType())) {
+        entrez = true;
       }
+    }
 
-      assertTrue("Ensemble symbol cannot be found", ensemble);
-      assertTrue("Hgnc id cannot be found", hgncId);
-      assertTrue("Entrez cannot be found", entrez);
+    assertTrue("Ensemble symbol cannot be found", ensemble);
+    assertTrue("Hgnc id cannot be found", hgncId);
+    assertTrue("Entrez cannot be found", entrez);
   }
 
   @Test(timeout = 15000)
   public void testGetAnnotationsForInvalid() throws Exception {
-      MiriamData nsmf = new MiriamData(MiriamType.ENTREZ, "blabla");
-      GenericProtein proteinAlias = new GenericProtein("id");
-      proteinAlias.addMiriamData(nsmf);
-      entrezAnnotator.annotateElement(proteinAlias);
+    MiriamData nsmf = new MiriamData(MiriamType.ENTREZ, "blabla");
+    GenericProtein proteinAlias = new GenericProtein("id");
+    proteinAlias.addMiriamData(nsmf);
+    entrezAnnotator.annotateElement(proteinAlias);
 
-      assertEquals(1, getWarnings().size());
+    assertEquals(1, getWarnings().size());
   }
 
   @Test(timeout = 15000)
   public void testCachableInterfaceInvalidate() throws Exception {
     String query = "http://google.pl/";
-      String newRes = "hello";
+    String newRes = "hello";
 
-      cache.setCachedQuery(query, entrezAnnotator.getCacheType(), newRes);
-      String res = cache.getStringByQuery(query, entrezAnnotator.getCacheType());
-      assertEquals(newRes, res);
-      cache.invalidateByQuery(query, entrezAnnotator.getCacheType());
+    cache.setCachedQuery(query, entrezAnnotator.getCacheType(), newRes);
+    String res = cache.getStringByQuery(query, entrezAnnotator.getCacheType());
+    assertEquals(newRes, res);
+    cache.invalidateByQuery(query, entrezAnnotator.getCacheType());
 
-      permanentDatabaseLevelCache.waitToFinishTasks();
+    permanentDatabaseLevelCache.waitToFinishTasks();
 
-      res = cache.getStringByQuery(query, entrezAnnotator.getCacheType());
+    res = cache.getStringByQuery(query, entrezAnnotator.getCacheType());
 
-      assertNotNull(res);
+    assertNotNull(res);
 
-      assertFalse("Value wasn't refreshed from db", newRes.equals(res));
+    assertFalse("Value wasn't refreshed from db", newRes.equals(res));
   }
 
   @Test
   public void testStatus() throws Exception {
-      assertEquals(ExternalServiceStatusType.OK, entrezAnnotator.getServiceStatus().getStatus());
+    assertEquals(ExternalServiceStatusType.OK, entrezAnnotator.getServiceStatus().getStatus());
   }
 
   @Test
@@ -144,20 +132,20 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
 
   @Test(expected = InvalidArgumentException.class)
   public void testRefreshInvalidCacheQuery() throws Exception {
-      entrezAnnotator.refreshCacheQuery("invalid_query");
+    entrezAnnotator.refreshCacheQuery("invalid_query");
   }
 
   @Test(expected = InvalidArgumentException.class)
   public void testRefreshInvalidCacheQuery2() throws Exception {
-      entrezAnnotator.refreshCacheQuery(new Object());
+    entrezAnnotator.refreshCacheQuery(new Object());
   }
 
   @Test(timeout = 15000)
   public void testRefreshEntrezData() throws Exception {
-      assertNotNull(entrezAnnotator.refreshCacheQuery(EntrezAnnotator.ENTREZ_DATA_PREFIX + "6647"));
+    assertNotNull(entrezAnnotator.refreshCacheQuery(EntrezAnnotator.ENTREZ_DATA_PREFIX + "6647"));
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testRefreshCacheQueryNotAvailable() throws Exception {
     WebPageDownloader downloader = entrezAnnotator.getWebPageDownloader();
     GeneralCacheInterface originalCache = entrezAnnotator.getCache();
@@ -170,15 +158,13 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
           .thenThrow(new IOException());
       entrezAnnotator.setWebPageDownloader(mockDownloader);
       entrezAnnotator.refreshCacheQuery("http://google.pl/");
-      fail("Exception expected");
-    } catch (SourceNotAvailable e) {
     } finally {
       entrezAnnotator.setWebPageDownloader(downloader);
       entrezAnnotator.setCache(originalCache);
     }
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testRefreshCacheQueryWithInvalidEntrezServerResponse() throws Exception {
     WebPageDownloader downloader = entrezAnnotator.getWebPageDownloader();
     GeneralCacheInterface originalCache = entrezAnnotator.getCache();
@@ -191,8 +177,6 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
           .thenThrow(new IOException());
       entrezAnnotator.setWebPageDownloader(mockDownloader);
       entrezAnnotator.refreshCacheQuery(EntrezAnnotator.ENTREZ_DATA_PREFIX + "6647");
-      fail("Exception expected");
-    } catch (SourceNotAvailable e) {
     } finally {
       entrezAnnotator.setWebPageDownloader(downloader);
       entrezAnnotator.setCache(originalCache);
@@ -201,23 +185,23 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
 
   @Test
   public void testAnnotateElementWithTwoEntrez() throws Exception {
-      Species proteinAlias = new GenericProtein("id");
-      proteinAlias.addMiriamData(new MiriamData(MiriamType.ENTREZ, "6647"));
-      proteinAlias.addMiriamData(new MiriamData(MiriamType.ENTREZ, "6648"));
-      entrezAnnotator.annotateElement(proteinAlias);
+    Species proteinAlias = new GenericProtein("id");
+    proteinAlias.addMiriamData(new MiriamData(MiriamType.ENTREZ, "6647"));
+    proteinAlias.addMiriamData(new MiriamData(MiriamType.ENTREZ, "6648"));
+    entrezAnnotator.annotateElement(proteinAlias);
 
-      assertEquals(3, getWarnings().size());
+    assertEquals(3, getWarnings().size());
   }
 
   @Test
   public void testAnnotateElementWithEncodedSynonyms() throws Exception {
-      Species proteinAlias = new GenericProtein("id");
-      proteinAlias.addMiriamData(new MiriamData(MiriamType.ENTREZ, "834106"));
-      entrezAnnotator.annotateElement(proteinAlias);
+    Species proteinAlias = new GenericProtein("id");
+    proteinAlias.addMiriamData(new MiriamData(MiriamType.ENTREZ, "834106"));
+    entrezAnnotator.annotateElement(proteinAlias);
 
-      for (String synonym : proteinAlias.getSynonyms()) {
-        assertFalse("Invalid character found in synonym: " + synonym, synonym.contains("&"));
-      }
+    for (String synonym : proteinAlias.getSynonyms()) {
+      assertFalse("Invalid character found in synonym: " + synonym, synonym.contains("&"));
+    }
   }
 
   @Test
@@ -251,7 +235,7 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testParseInvalidEntrezResponse() throws Exception {
     WebPageDownloader downloader = entrezAnnotator.getWebPageDownloader();
     GeneralCacheInterface cache = entrezAnnotator.getCache();
@@ -262,8 +246,6 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
       when(mockDownloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn(response);
       entrezAnnotator.setWebPageDownloader(mockDownloader);
       entrezAnnotator.getEntrezForMiriamData(new MiriamData(), "");
-      fail("Exception expected");
-    } catch (AnnotatorException e) {
     } finally {
       entrezAnnotator.setWebPageDownloader(downloader);
       entrezAnnotator.setCache(cache);
@@ -271,7 +253,7 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
 
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testParseInvalidEntrezResponse2() throws Exception {
     WebPageDownloader downloader = entrezAnnotator.getWebPageDownloader();
     GeneralCacheInterface cache = entrezAnnotator.getCache();
@@ -282,8 +264,6 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
           .thenThrow(new WrongResponseCodeIOException(null, 404));
       entrezAnnotator.setWebPageDownloader(mockDownloader);
       entrezAnnotator.getEntrezForMiriamData(new MiriamData(), "");
-      fail("Exception expected");
-    } catch (AnnotatorException e) {
     } finally {
       entrezAnnotator.setWebPageDownloader(downloader);
       entrezAnnotator.setCache(cache);
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotatorTest.java
index 3f43c36c97..e907c37532 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotatorTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotatorTest.java
@@ -57,20 +57,15 @@ public class GoAnnotatorTest extends AnnotationTestFunctions {
     assertTrue(go.getCommonName().toLowerCase().contains("chloroplast nucleoid"));
   }
 
-  @Test
+  @Test(expected = GoSearchException.class)
   public void testAnnotateWhenProblemWithNetworkResponse() throws Exception {
-    try {
-      MiriamData md = new MiriamData(MiriamRelationType.BQ_BIOL_IS_DESCRIBED_BY, MiriamType.GO, "GO:0042644");
-      GoAnnotator annotator = new GoAnnotator(null);
-      annotator.setMc(goAnnotator.getMc());
-      WebPageDownloader downloader = Mockito.mock(WebPageDownloader.class);
-      when(downloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("");
-      annotator.setWebPageDownloader(downloader);
-      annotator.getGoElement(md);
-      fail("Exception expected");
-    } catch (GoSearchException e) {
-      assertTrue(e.getMessage().contains("Problem with accesing go database"));
-    }
+    MiriamData md = new MiriamData(MiriamRelationType.BQ_BIOL_IS_DESCRIBED_BY, MiriamType.GO, "GO:0042644");
+    GoAnnotator annotator = new GoAnnotator(null);
+    annotator.setMc(goAnnotator.getMc());
+    WebPageDownloader downloader = Mockito.mock(WebPageDownloader.class);
+    when(downloader.getFromNetwork(anyString(), anyString(), nullable(String.class))).thenReturn("");
+    annotator.setWebPageDownloader(downloader);
+    annotator.getGoElement(md);
   }
 
   @Test(timeout = 15000)
@@ -89,7 +84,7 @@ public class GoAnnotatorTest extends AnnotationTestFunctions {
     assertFalse("Value wasn't refreshed from db", newRes.equals(res));
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testRefreshCacheQueryNotAvailable() throws Exception {
     WebPageDownloader downloader = goAnnotator.getWebPageDownloader();
     GeneralCacheInterface originalCache = goAnnotator.getCache();
@@ -102,8 +97,6 @@ public class GoAnnotatorTest extends AnnotationTestFunctions {
           .thenThrow(new IOException());
       goAnnotator.setWebPageDownloader(mockDownloader);
       goAnnotator.refreshCacheQuery("http://google.pl/");
-      fail("Exception expected");
-    } catch (SourceNotAvailable e) {
     } finally {
       goAnnotator.setWebPageDownloader(downloader);
       goAnnotator.setCache(originalCache);
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotatorTest.java
index a100c9a385..a85c04eceb 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotatorTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotatorTest.java
@@ -230,7 +230,7 @@ public class UniprotAnnotatorTest extends AnnotationTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = AnnotatorException.class)
   public void testAnnotateWithUniprotServerError() throws Exception {
     WebPageDownloader downloader = uniprotAnnotator.getWebPageDownloader();
     GeneralCacheInterface cache = uniprotAnnotator.getCache();
@@ -243,8 +243,6 @@ public class UniprotAnnotatorTest extends AnnotationTestFunctions {
       Species protein = new GenericProtein("id");
       protein.addMiriamData(new MiriamData(MiriamType.UNIPROT, "P01308"));
       uniprotAnnotator.annotateElement(protein);
-      fail("Exception expected");
-    } catch (AnnotatorException e) {
     } finally {
       uniprotAnnotator.setCache(cache);
       uniprotAnnotator.setWebPageDownloader(downloader);
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/genome/UcscReferenceGenomeConnectorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/genome/UcscReferenceGenomeConnectorTest.java
index 2533dde069..6d5a6e730b 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/genome/UcscReferenceGenomeConnectorTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/genome/UcscReferenceGenomeConnectorTest.java
@@ -60,7 +60,7 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
     assertTrue(list.size() >= 17);
   }
 
-  @Test
+  @Test(expected = ReferenceGenomeConnectorException.class)
   public void testGetAvailableGenomeVersionWhenProblemWithTaxonomyServer() throws Exception {
     MiriamData human = new MiriamData(MiriamType.TAXONOMY, "9606");
     TaxonomyBackend taxonomyBackend = connector.getTaxonomyBackend();
@@ -71,8 +71,6 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
       connector.setTaxonomyBackend(taxonomyMock);
 
       connector.getAvailableGenomeVersion(human);
-      fail("Exception expected");
-    } catch (ReferenceGenomeConnectorException e) {
     } finally {
       connector.setTaxonomyBackend(taxonomyBackend);
     }
@@ -96,7 +94,7 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
     assertTrue(list.contains(chicken));
   }
 
-  @Test
+  @Test(expected = ReferenceGenomeConnectorException.class)
   public void testGetAvailableOrganismsWhenUcscWebpageDown() throws Exception {
     WebPageDownloader downloader = connector.getWebPageDownloader();
     GeneralCacheInterface originalCache = connector.getCache();
@@ -109,9 +107,6 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
           .thenThrow(new IOException());
       connector.setWebPageDownloader(mockDownloader);
       connector.getAvailableOrganisms();
-      fail("Exception expected");
-    } catch (ReferenceGenomeConnectorException e) {
-      assertTrue(e.getMessage().contains("Problem with accessing UCSC database"));
     } finally {
       connector.setWebPageDownloader(downloader);
       connector.setCache(originalCache);
@@ -203,7 +198,7 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
   }
 
   @SuppressWarnings("unchecked")
-  @Test
+  @Test(expected = InvalidStateException.class)
   public void testDownloadGenomeVersionWhenInternalUrlIsInvalid() throws Exception {
     MiriamData yeast = new MiriamData(MiriamType.TAXONOMY, "1570291");
     String version = "eboVir3";
@@ -221,9 +216,6 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
         public void setProgress(double progress) {
         }
       }, false);
-      fail("Exception expected");
-
-    } catch (InvalidStateException e) {
     } finally {
       connector.setSyncExecutorService(originalExecutorService);
     }
@@ -625,7 +617,7 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
     assertEquals(12, version);
   }
 
-  @Test
+  @Test(expected = SourceNotAvailable.class)
   public void testRefreshCacheQueryNotAvailable() throws Exception {
     WebPageDownloader downloader = connector.getWebPageDownloader();
     GeneralCacheInterface originalCache = connector.getCache();
@@ -637,15 +629,13 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
           .thenThrow(new IOException());
       connector.setWebPageDownloader(mockDownloader);
       connector.refreshCacheQuery("http://google.pl/");
-      fail("Exception expected");
-    } catch (SourceNotAvailable e) {
     } finally {
       connector.setWebPageDownloader(downloader);
       connector.setCache(originalCache);
     }
   }
 
-  @Test
+  @Test(expected = FileNotAvailableException.class)
   public void testRefreshCacheQueryWhenFtpConnectionFails() throws Exception {
     MiriamData yeast = new MiriamData(MiriamType.TAXONOMY, "4932");
     String version = "sacCer3";
@@ -659,13 +649,8 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
       }
     };
 
-    try {
-      // exclude first cached value
-      connectorUnderTest.getGenomeVersionFile(yeast, version);
-      fail("Exception expected");
-    } catch (FileNotAvailableException e) {
-      assertTrue(e.getMessage().contains("FTP server refused connection"));
-    }
+    // exclude first cached value
+    connectorUnderTest.getGenomeVersionFile(yeast, version);
   }
 
   @Test(expected = FileNotAvailableException.class)
@@ -736,7 +721,7 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
     connectorUnderTest.getGenomeVersionFile(yeast, version);
   }
 
-  @Test
+  @Test(expected = FileNotAvailableException.class)
   public void testGetGenomeVersionFileWhenFtpDisconnectConnectionFails() throws Exception {
     MiriamData yeast = new MiriamData(MiriamType.TAXONOMY, "4932");
     String version = "sacCer3";
@@ -757,13 +742,8 @@ public class UcscReferenceGenomeConnectorTest extends AnnotationTestFunctions {
       }
     };
 
-    try {
-      // exclude first cached value
-      connectorUnderTest.getGenomeVersionFile(yeast, version);
-      fail("Exception expected");
-    } catch (FileNotAvailableException e) {
-      assertTrue(e.getMessage().contains("Problem with ftp connection"));
-    }
+    // exclude first cached value
+    connectorUnderTest.getGenomeVersionFile(yeast, version);
   }
 
   @Test
diff --git a/commons/src/test/java/lcsb/mapviewer/common/ObjectUtilsTest.java b/commons/src/test/java/lcsb/mapviewer/common/ObjectUtilsTest.java
index ff8b79effc..7cf9e2ff1a 100644
--- a/commons/src/test/java/lcsb/mapviewer/common/ObjectUtilsTest.java
+++ b/commons/src/test/java/lcsb/mapviewer/common/ObjectUtilsTest.java
@@ -1,58 +1,45 @@
 package lcsb.mapviewer.common;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.lang.reflect.Constructor;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 
 import lcsb.mapviewer.common.exception.InvalidArgumentException;
 
-public class ObjectUtilsTest {
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testGetIdOfObject() {
-		Object obj = new Object() {
-			@SuppressWarnings("unused")
-			public int getId() {
-				return 107;
-			}
-		};
-		assertEquals((Integer) 107, ObjectUtils.getIdOfObject(obj));
-	}
-
-	@Test
-	public void testGetIdOfObjectWithoutId() {
-		Object obj = new Object();
-		try {
-			ObjectUtils.getIdOfObject(obj);
-			fail("Exception expected");
-		} catch (InvalidArgumentException e) {
-
-		}
-	}
-
-	@Test
-	public void testPrivateConstructor() throws Exception {
-		try {
-			Constructor<?> constr = ObjectUtils.class.getDeclaredConstructor(new Class<?>[] {});
-			constr.setAccessible(true);
-			assertNotNull(constr.newInstance(new Object[] {}));
-		} catch (Exception e) {
-			throw e;
-		}
-	}
+public class ObjectUtilsTest extends CommonTestFunctions {
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test
+  public void testGetIdOfObject() {
+    Object obj = new Object() {
+      @SuppressWarnings("unused")
+      public int getId() {
+        return 107;
+      }
+    };
+    assertEquals((Integer) 107, ObjectUtils.getIdOfObject(obj));
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testGetIdOfObjectWithoutId() {
+    Object obj = new Object();
+    ObjectUtils.getIdOfObject(obj);
+  }
+
+  @Test
+  public void testPrivateConstructor() throws Exception {
+    Constructor<?> constr = ObjectUtils.class.getDeclaredConstructor(new Class<?>[] {});
+    constr.setAccessible(true);
+    assertNotNull(constr.newInstance(new Object[] {}));
+  }
 
 }
diff --git a/commons/src/test/java/lcsb/mapviewer/common/XmlParserTest.java b/commons/src/test/java/lcsb/mapviewer/common/XmlParserTest.java
index 0bc725c1b3..fbaed58e78 100644
--- a/commons/src/test/java/lcsb/mapviewer/common/XmlParserTest.java
+++ b/commons/src/test/java/lcsb/mapviewer/common/XmlParserTest.java
@@ -157,13 +157,11 @@ public class XmlParserTest extends CommonTestFunctions {
   @Test(expected = InvalidXmlSchemaException.class)
   public void testGetXmlDocumentFromInvalidString() throws Exception {
     XmlParser.getXmlDocumentFromString("<node>test<node>");
-    fail("Exception expected");
   }
 
   @Test(expected = InvalidXmlSchemaException.class)
   public void testGetXmlDocumentFromInvalidInputStream() throws Exception {
     XmlParser.getXmlDocumentFromInputSource(new InputSource(), true);
-    fail("Exception expected");
   }
 
   @Test
diff --git a/commons/src/test/java/lcsb/mapviewer/common/geometry/ColorParserTest.java b/commons/src/test/java/lcsb/mapviewer/common/geometry/ColorParserTest.java
index 31449494d7..bc6e7abe34 100644
--- a/commons/src/test/java/lcsb/mapviewer/common/geometry/ColorParserTest.java
+++ b/commons/src/test/java/lcsb/mapviewer/common/geometry/ColorParserTest.java
@@ -27,14 +27,12 @@ public class ColorParserTest extends CommonTestFunctions {
   public void testSetInvalidColor() throws Exception {
     ColorParser parser = new ColorParser();
     parser.parse("qwe");
-    fail("Exception expected");
   }
 
   @Test(expected = InvalidArgumentException.class)
   public void testSetInvalidColor2() throws Exception {
     ColorParser parser = new ColorParser();
     parser.parse("fffffff");
-    fail("Exception expected");
   }
 
   @Test
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java
index 3afd057ea3..efd8836919 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java
@@ -215,7 +215,6 @@ public class LayerXmlParserTest extends CellDesignerTestFunctions {
     String xmlString = readFile("testFiles/invalid/layer_oval.xml");
     Node node = getNodeFromXmlString(xmlString);
     parser.getLayerOval(node);
-    fail("Exception expected");
   }
 
   @Test
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/CellDesignerAliasConverterTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/CellDesignerAliasConverterTest.java
index 98003ed539..a846617fdc 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/CellDesignerAliasConverterTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/CellDesignerAliasConverterTest.java
@@ -1,51 +1,36 @@
 package lcsb.mapviewer.converter.model.celldesigner.geometry;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 import org.mockito.Mockito;
 
 import lcsb.mapviewer.common.exception.InvalidArgumentException;
 import lcsb.mapviewer.common.exception.NotImplementedException;
+import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions;
 import lcsb.mapviewer.model.map.species.Species;
 
-public class CellDesignerAliasConverterTest {
-
-	@AfterClass
-	public static void tearDownAfterClass() throws Exception {
-	}
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testConstructorWithInvalidArg() {
-		try {
-			new CellDesignerAliasConverter(null, false);
-			fail("Exception expected");
-		} catch (InvalidArgumentException e) {
-			assertTrue(e.getMessage().contains("element cannot be null"));
-		}
-	}
-
-	@Test
-	public void testConstructorWithInvalidArg2() {
-		try {
-			Species alias = Mockito.mock(Species.class);
-			new CellDesignerAliasConverter(alias, false);
-			fail("Exception expected");
-		} catch (NotImplementedException e) {
-			assertTrue(e.getMessage().contains("Unknown converter for class"));
-		}
-	}
+public class CellDesignerAliasConverterTest extends CellDesignerTestFunctions {
+
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+  }
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testConstructorWithInvalidArg() {
+    new CellDesignerAliasConverter(null, false);
+  }
+
+  @Test(expected = NotImplementedException.class)
+  public void testConstructorWithInvalidArg2() {
+    Species alias = Mockito.mock(Species.class);
+    new CellDesignerAliasConverter(alias, false);
+  }
 
 }
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinCellDesignerAliasConverterTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinCellDesignerAliasConverterTest.java
index 372e6f5812..c50ba1f308 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinCellDesignerAliasConverterTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinCellDesignerAliasConverterTest.java
@@ -1,48 +1,38 @@
 package lcsb.mapviewer.converter.model.celldesigner.geometry;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.awt.geom.Point2D;
 
-import org.apache.logging.log4j.*;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.junit.Test;
 import org.mockito.Mockito;
 
 import lcsb.mapviewer.common.Configuration;
 import lcsb.mapviewer.common.exception.NotImplementedException;
+import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions;
 import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerAnchor;
 import lcsb.mapviewer.model.map.species.GenericProtein;
 import lcsb.mapviewer.model.map.species.Protein;
 
-public class ProteinCellDesignerAliasConverterTest {
+public class ProteinCellDesignerAliasConverterTest extends CellDesignerTestFunctions {
   Logger logger = LogManager.getLogger(ProteinCellDesignerAliasConverterTest.class);
 
   ProteinCellDesignerAliasConverter converter = new ProteinCellDesignerAliasConverter(false);
 
-  @Test
+  @Test(expected = NotImplementedException.class)
   public void testNotImplementedMethod() {
-    try {
-      Protein alias = Mockito.mock(Protein.class);
-      converter.getBoundPathIterator(alias);
-      fail("Exception expected");
-    } catch (NotImplementedException e) {
-      assertTrue(e.getMessage().contains("Not implemented protein converter for type"));
-    }
+    Protein alias = Mockito.mock(Protein.class);
+    converter.getBoundPathIterator(alias);
   }
 
-  @Test
+  @Test(expected = NotImplementedException.class)
   public void testGetPointCoordinates() {
-    try {
-      Protein alias = Mockito.spy(Protein.class);
-      alias.setWidth(10);
-      alias.setHeight(10);
-      converter.getPointCoordinates(alias, CellDesignerAnchor.E);
-      fail("Exception expected");
-    } catch (NotImplementedException e) {
-      assertTrue(e.getMessage().contains("Unknown type"));
-    }
+    Protein alias = Mockito.spy(Protein.class);
+    alias.setWidth(10);
+    alias.setHeight(10);
+    converter.getPointCoordinates(alias, CellDesignerAnchor.E);
   }
 
   @Test
@@ -60,5 +50,4 @@ public class ProteinCellDesignerAliasConverterTest {
     }
   }
 
-
 }
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/SimpleMoleculeCellDesignerAliasConverterTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/SimpleMoleculeCellDesignerAliasConverterTest.java
index 25479733a0..7fb94dd1f6 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/SimpleMoleculeCellDesignerAliasConverterTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/SimpleMoleculeCellDesignerAliasConverterTest.java
@@ -1,24 +1,20 @@
 package lcsb.mapviewer.converter.model.celldesigner.geometry;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.awt.geom.Point2D;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 
 import lcsb.mapviewer.common.Configuration;
 import lcsb.mapviewer.common.exception.NotImplementedException;
+import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions;
 import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerAnchor;
 import lcsb.mapviewer.model.map.model.Model;
 import lcsb.mapviewer.model.map.model.ModelFullIndexed;
 import lcsb.mapviewer.model.map.species.SimpleMolecule;
 
-public class SimpleMoleculeCellDesignerAliasConverterTest {
+public class SimpleMoleculeCellDesignerAliasConverterTest extends CellDesignerTestFunctions {
 
   SimpleMoleculeCellDesignerAliasConverter converter = new SimpleMoleculeCellDesignerAliasConverter(false);
 
@@ -34,14 +30,9 @@ public class SimpleMoleculeCellDesignerAliasConverterTest {
   public void tearDown() throws Exception {
   }
 
-  @Test
+  @Test(expected = NotImplementedException.class)
   public void testPathIterator() {
-    try {
-      converter.getBoundPathIterator(null);
-      fail("Exception expected");
-    } catch (NotImplementedException e) {
-
-    }
+    converter.getBoundPathIterator(null);
   }
 
   @Test
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/helper/CellDesignerPolygonTransformationTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/helper/CellDesignerPolygonTransformationTest.java
index 1b1a46ccdb..056731ff04 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/helper/CellDesignerPolygonTransformationTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/helper/CellDesignerPolygonTransformationTest.java
@@ -1,71 +1,51 @@
 package lcsb.mapviewer.converter.model.celldesigner.geometry.helper;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 import java.awt.geom.Point2D;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 
 import lcsb.mapviewer.common.exception.InvalidArgumentException;
-
-public class CellDesignerPolygonTransformationTest {
-	CellDesignerPolygonTransformation tranformation = new CellDesignerPolygonTransformation();
-
-	@AfterClass
-	public static void tearDownAfterClass() throws Exception {
-	}
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testGetPointOnInvalidPolygonByAnchor() {
-		try {
-			tranformation.getPointOnPolygonByAnchor(new ArrayList<>(), null);
-			fail("Exception expected");
-		} catch (InvalidArgumentException e) {
-			assertTrue(e.getMessage().contains("Invalid number of points"));
-		}
-	}
-
-	@Test
-	public void testGetPointOnPolygonByInvalidAnchor() {
-		try {
-			List<Point2D> list = new ArrayList<>();
-			for (int i = 0; i < CellDesignerAnchor.DIFFERENT_ANCHORS / 2; i++) {
-				list.add(new Point2D.Double());
-			}
-			tranformation.getPointOnPolygonByAnchor(list, null);
-			fail("Exception expected");
-		} catch (InvalidArgumentException e) {
-			assertTrue(e.getMessage().contains("Invalid anchor"));
-		}
-	}
-
-	@Test
-	public void testGetPointOnPolygonByInvalidAnchor2() {
-		try {
-			List<Point2D> list = new ArrayList<>();
-			for (int i = 0; i < CellDesignerAnchor.DIFFERENT_ANCHORS; i++) {
-				list.add(new Point2D.Double());
-			}
-			tranformation.getPointOnPolygonByAnchor(list, null);
-			tranformation.getPointOnPolygonByAnchor(new ArrayList<>(), null);
-			fail("Exception expected");
-		} catch (InvalidArgumentException e) {
-			assertTrue(e.getMessage().contains("Invalid anchor"));
-		}
-	}
+import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions;
+
+public class CellDesignerPolygonTransformationTest extends CellDesignerTestFunctions {
+  CellDesignerPolygonTransformation tranformation = new CellDesignerPolygonTransformation();
+
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+  }
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testGetPointOnInvalidPolygonByAnchor() {
+    tranformation.getPointOnPolygonByAnchor(new ArrayList<>(), null);
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testGetPointOnPolygonByInvalidAnchor() {
+    List<Point2D> list = new ArrayList<>();
+    for (int i = 0; i < CellDesignerAnchor.DIFFERENT_ANCHORS / 2; i++) {
+      list.add(new Point2D.Double());
+    }
+    tranformation.getPointOnPolygonByAnchor(list, null);
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testGetPointOnPolygonByInvalidAnchor2() {
+    List<Point2D> list = new ArrayList<>();
+    for (int i = 0; i < CellDesignerAnchor.DIFFERENT_ANCHORS; i++) {
+      list.add(new Point2D.Double());
+    }
+    tranformation.getPointOnPolygonByAnchor(list, null);
+    tranformation.getPointOnPolygonByAnchor(new ArrayList<>(), null);
+  }
 
 }
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXmlTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXmlTest.java
index 2a28d0469b..3b13bce3e6 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXmlTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXmlTest.java
@@ -135,7 +135,7 @@ public class ReactionToXmlTest extends CellDesignerTestFunctions {
 
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testInvalidToXml() throws InconsistentModelException {
 
     Model model = new ModelFullIndexed(null);
@@ -158,16 +158,11 @@ public class ReactionToXmlTest extends CellDesignerTestFunctions {
     reaction.addReactant(reactant);
     reaction.addProduct(product);
 
-    try {
-      toXmlParser.toXml(reaction);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-
-    }
+    toXmlParser.toXml(reaction);
 
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testInvalidReaction() throws InconsistentModelException {
 
     Model model = new ModelFullIndexed(null);
@@ -187,42 +182,25 @@ public class ReactionToXmlTest extends CellDesignerTestFunctions {
     reaction.addReactant(reactant);
     reaction.addProduct(product);
 
-    try {
-      toXmlParser.toXml(reaction);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Unknown reaction type"));
-    }
+    toXmlParser.toXml(reaction);
 
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testGetConnectSchemeXmlStringForReaction() {
-    try {
-      toXmlParser.getConnectSchemeXmlStringForReaction(new Reaction());
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Unknown reaction type"));
-    }
-
+    toXmlParser.getConnectSchemeXmlStringForReaction(new Reaction());
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testGetConnectSchemeXmlStringForReaction2() {
-    try {
-      // test internal implementation
-      toXmlParser = new ReactionToXml(elements, false) {
-        @Override
-        String getEditPointsXmlStringForReaction(Reaction reaction) {
-          return "";
-        }
-      };
-      toXmlParser.getConnectSchemeXmlStringForReaction(new DissociationReaction());
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-      assertTrue(e.getMessage().contains("Invalid editPoints string"));
-    }
-
+    // test internal implementation
+    toXmlParser = new ReactionToXml(elements, false) {
+      @Override
+      String getEditPointsXmlStringForReaction(Reaction reaction) {
+        return "";
+      }
+    };
+    toXmlParser.getConnectSchemeXmlStringForReaction(new DissociationReaction());
   }
 
   @Test
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesDataTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesDataTest.java
index 495605edbc..0de7742276 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesDataTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesDataTest.java
@@ -1,51 +1,42 @@
 package lcsb.mapviewer.converter.model.celldesigner.species;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 
 import lcsb.mapviewer.common.exception.InvalidArgumentException;
+import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions;
 import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerSpecies;
 import lcsb.mapviewer.model.map.species.GenericProtein;
 
-public class InternalModelSpeciesDataTest {
-
-	@AfterClass
-	public static void tearDownAfterClass() throws Exception {
-	}
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testGetters() {
-		InternalModelSpeciesData data = new InternalModelSpeciesData();
-		assertNotNull(data.getAll());
-		assertNotNull(data.getAntisenseRnas());
-		assertNotNull(data.getGenes());
-		assertNotNull(data.getProteins());
-		assertNotNull(data.getRnas());
-	}
-
-	@Test
-	public void testUpdateUnknownSpecies() {
-		InternalModelSpeciesData data = new InternalModelSpeciesData();
-		try {
-			data.updateSpecies(new CellDesignerSpecies<GenericProtein>(), null);
-			fail("Exception expected");
-		} catch (InvalidArgumentException e) {
-			assertTrue(e.getMessage().contains("Unknown species type"));
-		}
-	}
+public class InternalModelSpeciesDataTest extends CellDesignerTestFunctions {
+
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+  }
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test
+  public void testGetters() {
+    InternalModelSpeciesData data = new InternalModelSpeciesData();
+    assertNotNull(data.getAll());
+    assertNotNull(data.getAntisenseRnas());
+    assertNotNull(data.getGenes());
+    assertNotNull(data.getProteins());
+    assertNotNull(data.getRnas());
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testUpdateUnknownSpecies() {
+    InternalModelSpeciesData data = new InternalModelSpeciesData();
+    data.updateSpecies(new CellDesignerSpecies<GenericProtein>(), null);
+  }
 
 }
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidueTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidueTest.java
index 937d391afa..d03f41128b 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidueTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidueTest.java
@@ -62,33 +62,34 @@ public class ModificationResidueTest extends CellDesignerTestFunctions {
     assertEquals(state, original.getState());
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidAngle() {
+    CellDesignerModificationResidue original = new CellDesignerModificationResidue();
+    original.setAngle("a2.0");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidSize() {
+    CellDesignerModificationResidue original = new CellDesignerModificationResidue();
+    original.setSize("a2.0");
+  }
+
   @Test
   public void testGetters() {
     CellDesignerModificationResidue original = new CellDesignerModificationResidue();
 
     String doubleStr = "2.0";
-    String invalidDoubleStr = "a2.0";
     String nullStr = null;
     Double angle = 2.0;
     CellDesignerSpecies<?> species = new CellDesignerSpecies<IonChannelProtein>();
 
     original.setAngle(doubleStr);
     assertEquals(angle, original.getAngle(), Configuration.EPSILON);
-    try {
-      original.setAngle(invalidDoubleStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     original.setAngle(nullStr);
     assertNull(original.getAngle());
 
     original.setSize(doubleStr);
     assertEquals(angle, original.getSize(), Configuration.EPSILON);
-    try {
-      original.setSize(invalidDoubleStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     original.setSize(doubleStr);
     original.setSize(nullStr);
     assertNull(original.getSize());
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesStateTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesStateTest.java
index 1c6e9ca880..6f49cb2230 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesStateTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesStateTest.java
@@ -1,17 +1,15 @@
 package lcsb.mapviewer.converter.model.celldesigner.structure;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.awt.geom.Point2D;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 
 import lcsb.mapviewer.common.exception.InvalidArgumentException;
+import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions;
 import lcsb.mapviewer.converter.model.celldesigner.structure.fields.CellDesignerModificationResidue;
 import lcsb.mapviewer.converter.model.celldesigner.structure.fields.SpeciesState;
 import lcsb.mapviewer.model.map.species.Gene;
@@ -19,7 +17,7 @@ import lcsb.mapviewer.model.map.species.Rna;
 import lcsb.mapviewer.model.map.species.field.CodingRegion;
 import lcsb.mapviewer.model.map.species.field.ModificationSite;
 
-public class SpeciesStateTest {
+public class SpeciesStateTest extends CellDesignerTestFunctions {
 
   @Before
   public void setUp() throws Exception {
@@ -37,16 +35,11 @@ public class SpeciesStateTest {
     assertEquals(modifications, state.getModifications());
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testSetHomodimer() {
-    try {
-      SpeciesState state = new SpeciesState();
-
-      state.setHomodimer("inv");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
+    SpeciesState state = new SpeciesState();
 
-    }
+    state.setHomodimer("inv");
   }
 
   @Test
diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesTest.java
index 030cf3a904..12cadc1faf 100644
--- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesTest.java
+++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesTest.java
@@ -84,17 +84,12 @@ public class SpeciesTest extends CellDesignerTestFunctions {
     assertEquals(SbmlUnitType.COULUMB, copy.getSubstanceUnit());
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testSetId() {
     CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
     species.setElementId("");
     species.setElementId("xx");
-    try {
-      species.setElementId("yy");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-
-    }
+    species.setElementId("yy");
   }
 
   @Test
@@ -182,46 +177,49 @@ public class SpeciesTest extends CellDesignerTestFunctions {
     assertEquals(0, warningsCount);
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidAmount() {
+    CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
+    species.setInitialAmount("a1");
+  }
+
   @Test
   public void testSetInitialAmount() {
     CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
     species.setInitialAmount("1");
     assertEquals(1, species.getInitialAmount(), Configuration.EPSILON);
-    try {
-      species.setInitialAmount("a1");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     species.setInitialAmount("1");
     species.setInitialAmount((String) null);
     assertNull(species.getInitialAmount());
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidCharge() {
+    CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
+    species.setCharge("a1");
+  }
+
   @Test
   public void testSetCharge() {
     CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
     species.setCharge("1");
     assertEquals((Integer) 1, species.getCharge());
-    try {
-      species.setCharge("a1");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     species.setCharge("1");
     species.setCharge((String) null);
     assertNull(species.getCharge());
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidOnlySubstanceUnits() {
+    CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
+    species.setOnlySubstanceUnits("a1");
+  }
+
   @Test
   public void testSetOnlySubstanceUnits() {
     CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
     species.setOnlySubstanceUnits("true");
     assertTrue(species.getOnlySubstanceUnits());
-    try {
-      species.setOnlySubstanceUnits("a1");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     species.setOnlySubstanceUnits("false");
     assertFalse(species.getOnlySubstanceUnits());
 
@@ -230,17 +228,17 @@ public class SpeciesTest extends CellDesignerTestFunctions {
     assertFalse(species.getOnlySubstanceUnits());
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidInitialConcentration() {
+    CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
+    species.setInitialConcentration("a1");
+  }
+
   @Test
   public void testSetInitialConcentration() {
     CellDesignerSpecies<?> species = new CellDesignerSpecies<GenericProtein>();
     species.setInitialConcentration("1");
     assertEquals(1, species.getInitialConcentration(), Configuration.EPSILON);
-    try {
-      species.setInitialConcentration("a1");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
-    species.setInitialConcentration("1");
     species.setInitialConcentration((String) null);
     assertNull(species.getInitialConcentration());
   }
diff --git a/converter/src/test/java/lcsb/mapviewer/converter/ComplexZipConverterTest.java b/converter/src/test/java/lcsb/mapviewer/converter/ComplexZipConverterTest.java
index 682bed61ee..aa71186181 100644
--- a/converter/src/test/java/lcsb/mapviewer/converter/ComplexZipConverterTest.java
+++ b/converter/src/test/java/lcsb/mapviewer/converter/ComplexZipConverterTest.java
@@ -148,7 +148,7 @@ public class ComplexZipConverterTest extends ConverterTestFunctions {
     assertEquals(s3Model, s1_al1.getSubmodel().getSubmodel().getModel());
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testParamsMissing() throws Exception {
     ComplexZipConverter converter = new ComplexZipConverter(MockConverter.class);
     ComplexZipConverterParams params = new ComplexZipConverterParams();
@@ -157,15 +157,10 @@ public class ComplexZipConverterTest extends ConverterTestFunctions {
     params.entry(new ModelZipEntryFile("s1.xml", "s1", false, false, SubmodelType.DOWNSTREAM_TARGETS));
     params.entry(new ModelZipEntryFile("s3.xml", "s3", false, false, SubmodelType.UNKNOWN));
     params.entry(new ModelZipEntryFile("mapping.xml", null, false, true, null));
-    try {
-      converter.createModel(params);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-
-    }
+    converter.createModel(params);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testParamsInvalid1() throws Exception {
     // two mains
     ComplexZipConverter converter = new ComplexZipConverter(MockConverter.class);
@@ -176,15 +171,10 @@ public class ComplexZipConverterTest extends ConverterTestFunctions {
     params.entry(new ModelZipEntryFile("s2.xml", "s2", false, false, SubmodelType.PATHWAY));
     params.entry(new ModelZipEntryFile("s3.xml", "s3", false, false, SubmodelType.UNKNOWN));
     params.entry(new ModelZipEntryFile("mapping.xml", null, false, true, null));
-    try {
-      converter.createModel(params);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-
-    }
+    converter.createModel(params);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testParamsInvalid2() throws Exception {
     // zero mains
     ComplexZipConverter converter = new ComplexZipConverter(MockConverter.class);
@@ -195,15 +185,10 @@ public class ComplexZipConverterTest extends ConverterTestFunctions {
     params.entry(new ModelZipEntryFile("s2.xml", "s2", false, false, SubmodelType.PATHWAY));
     params.entry(new ModelZipEntryFile("s3.xml", "s3", false, false, SubmodelType.UNKNOWN));
     params.entry(new ModelZipEntryFile("mapping.xml", null, false, true, null));
-    try {
-      converter.createModel(params);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-
-    }
+    converter.createModel(params);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testParamsInvalid3() throws Exception {
     // two mappings
     ComplexZipConverter converter = new ComplexZipConverter(MockConverter.class);
@@ -214,12 +199,7 @@ public class ComplexZipConverterTest extends ConverterTestFunctions {
     params.entry(new ModelZipEntryFile("s2.xml", "s2", false, false, SubmodelType.PATHWAY));
     params.entry(new ModelZipEntryFile("s3.xml", "s3", false, false, SubmodelType.UNKNOWN));
     params.entry(new ModelZipEntryFile("mapping.xml", null, false, true, null));
-    try {
-      converter.createModel(params);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-
-    }
+    converter.createModel(params);
   }
 
   @Test
@@ -252,7 +232,7 @@ public class ComplexZipConverterTest extends ConverterTestFunctions {
     }
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testTooManyParams() throws Exception {
     // zero mappings (should be ok)
     ComplexZipConverter converter = new ComplexZipConverter(MockConverter.class);
@@ -264,15 +244,10 @@ public class ComplexZipConverterTest extends ConverterTestFunctions {
     params.entry(new ModelZipEntryFile("s3.xml", "s3", false, false, SubmodelType.UNKNOWN));
     params.entry(new ModelZipEntryFile("mapping.xml", "", false, false, null));
     params.entry(new ModelZipEntryFile("blabla.xml", "s3", false, false, SubmodelType.UNKNOWN));
-    try {
-      converter.createModel(params);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-
-    }
+    converter.createModel(params);
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testInvalidMappingFile() throws Exception {
     // zero mappings (should be ok)
     ComplexZipConverter converter = new ComplexZipConverter(MockConverter.class);
@@ -280,12 +255,7 @@ public class ComplexZipConverterTest extends ConverterTestFunctions {
     params.zipFile(new ZipFile("testFiles/invalid_mapping.zip"));
     params.entry(new ModelZipEntryFile("main.xml", "main", true, false, null));
     params.entry(new ModelZipEntryFile("mapping.xml", null, false, true, null));
-    try {
-      converter.createModel(params);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-
-    }
+    converter.createModel(params);
   }
 
   @Test
diff --git a/model-command/src/test/java/lcsb/mapviewer/commands/CopyCommandTest.java b/model-command/src/test/java/lcsb/mapviewer/commands/CopyCommandTest.java
index 814c084559..129cb31e2b 100644
--- a/model-command/src/test/java/lcsb/mapviewer/commands/CopyCommandTest.java
+++ b/model-command/src/test/java/lcsb/mapviewer/commands/CopyCommandTest.java
@@ -191,7 +191,7 @@ public class CopyCommandTest extends CommandTestFunctions {
     assertEquals(0, comparator.compare(model, copy));
   }
 
-  @Test
+  @Test(expected = InvalidArgumentException.class)
   public void testCopyModelWithSubmodelsThrowException() throws Exception {
     Model model = getModel();
     Model model2 = getModel();
@@ -199,11 +199,7 @@ public class CopyCommandTest extends CommandTestFunctions {
 
     model.getElementByElementId("a_id")
         .setSubmodel(new ElementSubmodelConnection(model2, SubmodelType.DOWNSTREAM_TARGETS));
-    try {
-      new CopyCommand(model).execute();
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
+    new CopyCommand(model).execute();
   }
 
   private Model getModel() {
diff --git a/model-command/src/test/java/lcsb/mapviewer/commands/CreateHierarchyCommandTest.java b/model-command/src/test/java/lcsb/mapviewer/commands/CreateHierarchyCommandTest.java
index 671246bf63..2fd92abf44 100644
--- a/model-command/src/test/java/lcsb/mapviewer/commands/CreateHierarchyCommandTest.java
+++ b/model-command/src/test/java/lcsb/mapviewer/commands/CreateHierarchyCommandTest.java
@@ -157,18 +157,13 @@ public class CreateHierarchyCommandTest extends CommandTestFunctions {
     assertEquals(parent1, parent2);
   }
 
-  @Test
+  @Test(expected = InvalidStateException.class)
   public void testRecallHierachyCreation() throws Exception {
     Model model = getModelForFile("testFiles/artifitial_compartments.xml", false);
 
     CreateHierarchyCommand command = new CreateHierarchyCommand(model, 2, 2);
     command.execute();
-    try {
-      command.execute();
-      fail("Exception expected");
-    } catch (InvalidStateException e) {
-
-    }
+    command.execute();
   }
 
   @Test
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/compartment/CompartmentTest.java b/model/src/test/java/lcsb/mapviewer/model/map/compartment/CompartmentTest.java
index 90d967d8f8..59c5cf8432 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/compartment/CompartmentTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/compartment/CompartmentTest.java
@@ -208,10 +208,27 @@ public class CompartmentTest extends ModelTestFunctions {
     assertNotNull(copy);
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidThickness() {
+    Compartment compartment = new Compartment();
+    compartment.setLineThickness("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidLineInnerWidth() {
+    Compartment compartment = new Compartment();
+    compartment.setLineInnerWidth("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidLineOuterWdth() {
+    Compartment compartment = new Compartment();
+    compartment.setLineOuterWidth("a1.6");
+  }
+
   @Test
   public void testGetters() {
     Compartment compartment = new Compartment();
-    String invalidVal = "a1.6";
     String val = "1.6";
     Double dVal = 1.6;
 
@@ -223,22 +240,6 @@ public class CompartmentTest extends ModelTestFunctions {
     assertEquals(dVal, compartment.getOuterWidth(), Configuration.EPSILON);
     assertEquals(dVal, compartment.getInnerWidth(), Configuration.EPSILON);
 
-    try {
-      compartment.setLineThickness(invalidVal);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
-    try {
-      compartment.setLineOuterWidth(invalidVal);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
-    try {
-      compartment.setLineInnerWidth(invalidVal);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
-
     compartment.setNamePoint(2, 3);
     assertEquals(0, compartment.getNamePoint().distance(2, 3), Configuration.EPSILON);
 
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerOvalTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerOvalTest.java
index c697d5c06b..971a65b5ba 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerOvalTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerOvalTest.java
@@ -56,6 +56,30 @@ public class LayerOvalTest extends ModelTestFunctions {
     Mockito.spy(LayerOval.class).copy();
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidX() {
+    LayerOval oval = createOval();
+    oval.setX("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidY() {
+    LayerOval oval = createOval();
+    oval.setY("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidWidth() {
+    LayerOval oval = createOval();
+    oval.setWidth("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidHeight() {
+    LayerOval oval = createOval();
+    oval.setHeight("a1.6");
+  }
+
   @Test
   public void testGetters() {
     LayerOval oval = createOval();
@@ -79,11 +103,6 @@ public class LayerOvalTest extends ModelTestFunctions {
 
     oval.setY(yParam);
     assertEquals(y, oval.getY(), Configuration.EPSILON);
-    try {
-      oval.setY(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     oval.setY((Double) null);
     assertNull(oval.getY());
     oval.setY(y);
@@ -91,11 +110,6 @@ public class LayerOvalTest extends ModelTestFunctions {
 
     oval.setX(xParam);
     assertEquals(x, oval.getX(), Configuration.EPSILON);
-    try {
-      oval.setX(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     oval.setX((Double) null);
     assertNull(oval.getX());
     oval.setX(x);
@@ -103,11 +117,6 @@ public class LayerOvalTest extends ModelTestFunctions {
 
     oval.setWidth(widthParam);
     assertEquals(width, oval.getWidth(), Configuration.EPSILON);
-    try {
-      oval.setWidth(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     oval.setWidth((Double) null);
     assertNull(oval.getWidth());
     oval.setWidth(width);
@@ -115,11 +124,6 @@ public class LayerOvalTest extends ModelTestFunctions {
 
     oval.setHeight(heightParam);
     assertEquals(height, oval.getHeight(), Configuration.EPSILON);
-    try {
-      oval.setHeight(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     oval.setHeight((Double) null);
     assertNull(oval.getHeight());
     oval.setHeight(height);
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerRectTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerRectTest.java
index 199c1eca73..d89cd63f29 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerRectTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerRectTest.java
@@ -56,6 +56,30 @@ public class LayerRectTest extends ModelTestFunctions {
     Mockito.spy(LayerRect.class).copy();
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidX() {
+    LayerRect rect = createRect();
+    rect.setX("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidY() {
+    LayerRect rect = createRect();
+    rect.setY("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidWidth() {
+    LayerRect rect = createRect();
+    rect.setWidth("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidHeight() {
+    LayerRect rect = createRect();
+    rect.setHeight("a1.6");
+  }
+
   @Test
   public void testGetters() {
     LayerRect rect = createRect();
@@ -72,17 +96,10 @@ public class LayerRectTest extends ModelTestFunctions {
     String heightParam = "72.2";
     Double height = 72.2;
 
-    String invalidNumberStr = "xxd";
-
     Color color = Color.BLACK;
 
     rect.setY(yParam);
     assertEquals(y, rect.getY(), Configuration.EPSILON);
-    try {
-      rect.setY(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     rect.setY((Double) null);
     assertNull(rect.getY());
     rect.setY(y);
@@ -90,11 +107,6 @@ public class LayerRectTest extends ModelTestFunctions {
 
     rect.setX(xParam);
     assertEquals(x, rect.getX(), Configuration.EPSILON);
-    try {
-      rect.setX(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     rect.setX((Double) null);
     assertNull(rect.getX());
     rect.setX(x);
@@ -102,11 +114,6 @@ public class LayerRectTest extends ModelTestFunctions {
 
     rect.setWidth(widthParam);
     assertEquals(width, rect.getWidth(), Configuration.EPSILON);
-    try {
-      rect.setWidth(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     rect.setWidth((Double) null);
     assertNull(rect.getWidth());
     rect.setWidth(width);
@@ -114,11 +121,6 @@ public class LayerRectTest extends ModelTestFunctions {
 
     rect.setHeight(heightParam);
     assertEquals(height, rect.getHeight(), Configuration.EPSILON);
-    try {
-      rect.setHeight(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     rect.setHeight((Double) null);
     assertNull(rect.getHeight());
     rect.setHeight(height);
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerTextTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerTextTest.java
index 42f90c7071..dd50ebc9e8 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerTextTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/graphics/LayerTextTest.java
@@ -69,6 +69,36 @@ public class LayerTextTest extends ModelTestFunctions {
     assertNotNull(copy.getBorder());
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidX() {
+    LayerText text = createText();
+    text.setX("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidY() {
+    LayerText text = createText();
+    text.setY("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidWidth() {
+    LayerText text = createText();
+    text.setWidth("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidHeight() {
+    LayerText text = createText();
+    text.setHeight("a1.6");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidFontSize() {
+    LayerText text = createText();
+    text.setFontSize("a1.6");
+  }
+
   @Test
   public void testGetters() {
     LayerText text = createText();
@@ -92,11 +122,6 @@ public class LayerTextTest extends ModelTestFunctions {
 
     text.setY(yParam);
     assertEquals(y, text.getY(), Configuration.EPSILON);
-    try {
-      text.setY(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     assertEquals(y, text.getY(), Configuration.EPSILON);
     text.setY((Double) null);
     assertNull(text.getY());
@@ -105,11 +130,6 @@ public class LayerTextTest extends ModelTestFunctions {
 
     text.setX(xParam);
     assertEquals(x, text.getX(), Configuration.EPSILON);
-    try {
-      text.setX(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     text.setX((Double) null);
     assertNull(text.getX());
     text.setX(x);
@@ -117,11 +137,6 @@ public class LayerTextTest extends ModelTestFunctions {
 
     text.setFontSize(fontSizeParam);
     assertEquals(fontSize, text.getFontSize(), Configuration.EPSILON);
-    try {
-      text.setFontSize(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     text.setFontSize((Double) null);
     assertNull(text.getFontSize());
     text.setFontSize(fontSize);
@@ -129,11 +144,6 @@ public class LayerTextTest extends ModelTestFunctions {
 
     text.setWidth(widthParam);
     assertEquals(width, text.getWidth(), Configuration.EPSILON);
-    try {
-      text.setWidth(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     text.setWidth((Double) null);
     assertNull(text.getWidth());
     text.setWidth(width);
@@ -141,11 +151,6 @@ public class LayerTextTest extends ModelTestFunctions {
 
     text.setHeight(heightParam);
     assertEquals(height, text.getHeight(), Configuration.EPSILON);
-    try {
-      text.setHeight(invalidNumberStr);
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
     text.setHeight((Double) null);
     assertNull(text.getHeight());
     text.setHeight(height);
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelComparatorTest.java
index 1a61931be7..5c201cd3aa 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelComparatorTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelComparatorTest.java
@@ -109,7 +109,7 @@ public class ModelComparatorTest extends ModelTestFunctions {
     assertTrue(comparator.compare(model2, model1) != 0);
   }
 
-  @Test
+  @Test(expected = NotImplementedException.class)
   public void testInvalid() {
     Model model1 = getModel();
     Model model2 = getModel();
@@ -120,20 +120,7 @@ public class ModelComparatorTest extends ModelTestFunctions {
 
     model2.addElement(mockSpecies);
 
-    try {
-      comparator.compare(model1, model2);
-      fail("Exception expected");
-
-    } catch (NotImplementedException e) {
-
-    }
-    try {
-      comparator.compare(model2, model1);
-      fail("Exception expected");
-
-    } catch (NotImplementedException e) {
-
-    }
+    comparator.compare(model1, model2);
   }
 
   @Test
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/ElementTest.java b/model/src/test/java/lcsb/mapviewer/model/map/species/ElementTest.java
index 29bbd35d2b..13119ca597 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/species/ElementTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/species/ElementTest.java
@@ -120,6 +120,18 @@ public class ElementTest extends ModelTestFunctions {
     assertEquals(16.0, protein.getSize(), Configuration.EPSILON);
   }
 
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidWidth() {
+    Element element = new GenericProtein();
+    element.setWidth("as");
+  }
+
+  @Test(expected = InvalidArgumentException.class)
+  public void testSetInvalidHeight() {
+    Element element = new GenericProtein();
+    element.setHeight("as");
+  }
+
   @Test
   public void testGetters() {
     Element element = new GenericProtein();
@@ -178,11 +190,6 @@ public class ElementTest extends ModelTestFunctions {
     assertNull(element.getWidth());
     element.setWidth(width);
     assertEquals(width, element.getWidth(), Configuration.EPSILON);
-    try {
-      element.setWidth("as");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
 
     element.setHeight(heightStr);
     assertEquals(height, element.getHeight(), Configuration.EPSILON);
@@ -190,11 +197,6 @@ public class ElementTest extends ModelTestFunctions {
     assertNull(element.getHeight());
     element.setHeight(height);
     assertEquals(height, element.getHeight(), Configuration.EPSILON);
-    try {
-      element.setHeight("as");
-      fail("Exception expected");
-    } catch (InvalidArgumentException e) {
-    }
 
     element.setCompartment(compartment);
     assertEquals(compartment, element.getCompartment());
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/field/StructureTest.java b/model/src/test/java/lcsb/mapviewer/model/map/species/field/StructureTest.java
index 4e40ae40b2..2014473d37 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/species/field/StructureTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/species/field/StructureTest.java
@@ -1,66 +1,61 @@
 package lcsb.mapviewer.model.map.species.field;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.util.HashSet;
 
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 import org.mockito.Mockito;
 
 import lcsb.mapviewer.common.exception.NotImplementedException;
 
 public class StructureTest {
 
-	@AfterClass
-	public static void tearDownAfterClass() throws Exception {
-	}
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testGetters() {
-		Structure s = new Structure();
-		UniprotRecord ur = new UniprotRecord();
-		ur.setId(100);
-		ur.setUniprotId("P29373");
-
-		int id = 101;
-		s.setUniprot(ur);
-		s.setId(id);
-		
-		ur.setStructures(new HashSet<Structure>() {private static final long serialVersionUID = 1L; {add(s);} });
-
-		assertEquals(ur, s.getUniprot());
-		assertEquals(id, s.getId());
-		assertEquals(s, ur.getStructures().iterator().next());
-	}
-
-	@Test
-	public void testCopy() {
-		Structure s = new Structure().copy();
-		assertNotNull(s);
-	}
-
-	@Test
-	public void testInvalidCopy() {
-		Structure s = Mockito.spy(Structure.class);
-		try {
-			s.copy();
-			fail("Exception expected");
-		} catch (NotImplementedException e) {
-
-		}
-	}
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+  }
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test
+  public void testGetters() {
+    Structure s = new Structure();
+    UniprotRecord ur = new UniprotRecord();
+    ur.setId(100);
+    ur.setUniprotId("P29373");
+
+    int id = 101;
+    s.setUniprot(ur);
+    s.setId(id);
+
+    ur.setStructures(new HashSet<Structure>() {
+      private static final long serialVersionUID = 1L;
+      {
+        add(s);
+      }
+    });
+
+    assertEquals(ur, s.getUniprot());
+    assertEquals(id, s.getId());
+    assertEquals(s, ur.getStructures().iterator().next());
+  }
+
+  @Test
+  public void testCopy() {
+    Structure s = new Structure().copy();
+    assertNotNull(s);
+  }
+
+  @Test(expected = NotImplementedException.class)
+  public void testInvalidCopy() {
+    Structure s = Mockito.spy(Structure.class);
+    s.copy();
+  }
 
 }
diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/field/UniprotRecordTest.java b/model/src/test/java/lcsb/mapviewer/model/map/species/field/UniprotRecordTest.java
index 38460ffb23..26e3aa41a8 100644
--- a/model/src/test/java/lcsb/mapviewer/model/map/species/field/UniprotRecordTest.java
+++ b/model/src/test/java/lcsb/mapviewer/model/map/species/field/UniprotRecordTest.java
@@ -1,13 +1,8 @@
 package lcsb.mapviewer.model.map.species.field;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.junit.*;
 import org.mockito.Mockito;
 
 import lcsb.mapviewer.common.exception.NotImplementedException;
@@ -16,46 +11,41 @@ import lcsb.mapviewer.model.map.species.Species;
 
 public class UniprotRecordTest {
 
-	@AfterClass
-	public static void tearDownAfterClass() throws Exception {
-	}
-
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-
-	@Test
-	public void testGetters() {
-		UniprotRecord ur = new UniprotRecord();
-		Species species = new GenericProtein("id");
-		int id = 94;
-
-		ur.setSpecies(species);
-		ur.setId(id);
-
-		assertEquals(species, ur.getSpecies());
-		assertEquals(id, ur.getId());
-	}
-
-	@Test
-	public void testCopy() {
-		UniprotRecord ur = new UniprotRecord().copy();
-		assertNotNull(ur);
-	}
-
-	@Test
-	public void testInvalidCopy() {
-		UniprotRecord ur = Mockito.spy(UniprotRecord.class);
-		try {
-			ur.copy();
-			fail("Exception expected");
-		} catch (NotImplementedException e) {
-
-		}
-	}
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+  }
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test
+  public void testGetters() {
+    UniprotRecord ur = new UniprotRecord();
+    Species species = new GenericProtein("id");
+    int id = 94;
+
+    ur.setSpecies(species);
+    ur.setId(id);
+
+    assertEquals(species, ur.getSpecies());
+    assertEquals(id, ur.getId());
+  }
+
+  @Test
+  public void testCopy() {
+    UniprotRecord ur = new UniprotRecord().copy();
+    assertNotNull(ur);
+  }
+
+  @Test(expected = NotImplementedException.class)
+  public void testInvalidCopy() {
+    UniprotRecord ur = Mockito.spy(UniprotRecord.class);
+    ur.copy();
+  }
 
 }
diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/statistics/SearchHistoryDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/statistics/SearchHistoryDaoTest.java
index 08221a076f..d788a1c1e3 100644
--- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/statistics/SearchHistoryDaoTest.java
+++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/statistics/SearchHistoryDaoTest.java
@@ -1,11 +1,8 @@
 package lcsb.mapviewer.persist.dao.map.statistics;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import lcsb.mapviewer.model.map.statistics.SearchHistory;
@@ -27,19 +24,14 @@ public class SearchHistoryDaoTest extends PersistTestFunctions {
 
   @Test
   public void test() {
-    try {
-      SearchHistory searchHistory = new SearchHistory();
-      long count = searchHistoryDao.getCount();
-      searchHistory.setIpAddress("0.0.0.0");
-      searchHistory.setQuery("query ...");
-      searchHistory.setType(SearchType.GENERAL);
-      searchHistoryDao.add(searchHistory);
-      long count1 = searchHistoryDao.getCount();
-      assertEquals(count + 1, count1);
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail("Exception occurred");
-    }
+    SearchHistory searchHistory = new SearchHistory();
+    long count = searchHistoryDao.getCount();
+    searchHistory.setIpAddress("0.0.0.0");
+    searchHistory.setQuery("query ...");
+    searchHistory.setType(SearchType.GENERAL);
+    searchHistoryDao.add(searchHistory);
+    long count1 = searchHistoryDao.getCount();
+    assertEquals(count + 1, count1);
   }
 
 }
-- 
GitLab