Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Remove TestNG assert calls, and TestNG
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Jun 1, 2015
1 parent 2c041d9 commit 6dcb6a4
Show file tree
Hide file tree
Showing 22 changed files with 66 additions and 80 deletions.
6 changes: 0 additions & 6 deletions zanata-war/pom.xml
Expand Up @@ -2085,12 +2085,6 @@
<artifactId>mockito-core</artifactId>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<!-- We use testng in DBUnitImporter so can't use test scope here -->
</dependency>

<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
Expand Down
Expand Up @@ -12,7 +12,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import static org.testng.Assert.*;

public class DuplicateEmailValidatorTest {
private DuplicateEmailValidator validator;
Expand Down
Expand Up @@ -7,7 +7,6 @@
import javax.validation.ConstraintValidatorContext;

import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.*;

public class EmailListValidatorTest {

Expand All @@ -22,38 +21,40 @@ public void create() {

@Test
public void nullIsValid() throws Exception {
assertTrue(validator.isValid(null, context));
assertThat(validator.isValid(null, context)).isTrue();
}

@Test
public void emptyIsValid() throws Exception {
assertTrue(validator.isValid("", context));
assertThat(validator.isValid("", context)).isTrue();
}

@Test
public void aIsValid() throws Exception {
assertTrue(validator.isValid(" a@example.com ", context));
assertThat(validator.isValid(" a@example.com ", context)).isTrue();
}

@Test
public void aBIsValid() throws Exception {
assertTrue(validator.isValid("a@example.com, b@example.org", context));
assertThat(validator.isValid("a@example.com, b@example.org", context))
.isTrue();
}

@Test
public void CIsInvalid() throws Exception {
assertFalse(validator.isValid("c", context));
assertThat(validator.isValid("c", context)).isFalse();
}

@Test
public void DIsValid() throws Exception {
assertTrue(validator.isValid("d@example", context));
assertThat(validator.isValid("d@example", context)).isTrue();
}

@Test
public void aBCDIsValid() throws Exception {
assertFalse(validator
.isValid("a@example.com, b@example.org c d@example", context));
assertThat(validator
.isValid("a@example.com, b@example.org c d@example", context))
.isFalse();
}

@Test
Expand Down
Expand Up @@ -6,6 +6,7 @@

import lombok.Cleanup;

import org.assertj.core.api.Fail;
import org.dbunit.operation.DatabaseOperation;
import org.hibernate.JDBCException;
import org.hibernate.Query;
Expand All @@ -15,7 +16,6 @@
import org.hibernate.jdbc.Work;
import org.junit.Before;
import org.junit.Test;
import org.testng.Assert;
import org.zanata.ZanataDbunitJpaTest;

public class WrappedConnectionProviderTest extends ZanataDbunitJpaTest {
Expand Down Expand Up @@ -88,7 +88,8 @@ public void testWrapperWithNestedResults() throws Exception {
}

private void concurrentResultSetNotDetected() {
Assert.fail("Failed to detect concurrent ResultSet - is Wrapped*ConnectionProvider enabled in persistence.xml?");
Fail.fail("Failed to detect concurrent ResultSet - is " +
"Wrapped*ConnectionProvider enabled in persistence.xml?");
}

private void checkExceptionType(JDBCException e) {
Expand Down
Expand Up @@ -9,7 +9,6 @@
import org.zanata.util.EmptyEnumeration;

import static org.mockito.Mockito.when;
import static org.testng.Assert.*;

public class DeadLetterQueueReceiverTest {
private DeadLetterQueueReceiver receiver;
Expand Down
Expand Up @@ -14,7 +14,6 @@

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.*;

public class NotificationManagerTest {
private NotificationManager manager;
Expand Down
Expand Up @@ -6,7 +6,7 @@
import org.junit.Test;
import org.zanata.common.LocaleId;

import static org.testng.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

/**
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
Expand All @@ -22,6 +22,6 @@ public void testJsonOutput() throws IOException {
Locale locale = om.readValue(json, Locale.class);

Locale expected = new Locale(LocaleId.DE, "German");
assertEquals(locale, expected);
assertThat(locale).isEqualTo(expected);
}
}
@@ -1,13 +1,13 @@
package org.zanata.rest.editor.dto;

import static org.testng.Assert.assertEquals;

import java.io.IOException;

import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.zanata.common.ContentState;

import static org.assertj.core.api.Assertions.assertThat;

/**
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*/
Expand All @@ -27,6 +27,6 @@ public void testJsonOutput() throws IOException {
TransUnitStatus expected = new TransUnitStatus(100L, "rest id",
ContentState.NeedReview);

assertEquals(status, expected);
assertThat(status).isEqualTo(expected);
}
}
@@ -1,13 +1,10 @@
package org.zanata.rest.editor.dto;

import static org.testng.Assert.assertEquals;

import java.io.IOException;

import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.zanata.rest.dto.resource.TextFlowTarget;

import static org.assertj.core.api.Assertions.assertThat;

/**
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*/
Expand All @@ -23,7 +20,7 @@ public void testPutInvalidSource() {
public void testPutValidSource() {
TransUnit tu = new TransUnit();
tu.put(TransUnit.SOURCE, new EditorTextFlow());
assertEquals(tu.size(), 1);
assertThat(tu.size()).isEqualTo(1);
}

@Test(expected = ClassCastException.class)
Expand All @@ -36,6 +33,6 @@ public void testPutInvalidTarget() {
public void testPutValidTarget() {
TransUnit tu = new TransUnit();
tu.put("fr", new TextFlowTarget());
assertEquals(tu.size(), 1);
assertThat(tu.size()).isEqualTo(1);
}
}
Expand Up @@ -3,11 +3,10 @@
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.zanata.common.ContentState;
import org.zanata.common.LocaleId;

import java.io.IOException;

import static org.testng.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

/**
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
Expand All @@ -31,7 +30,7 @@ public void testJsonOutput() throws IOException {
expected.setPlural(false);
expected.setStatus(ContentState.NeedReview);

assertEquals(translationData, expected);
assertThat(translationData).isEqualTo(expected);
}

}
@@ -1,12 +1,11 @@
package org.zanata.rest.editor.dto;

import static org.testng.Assert.assertEquals;

import java.io.IOException;

import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.zanata.common.LocaleId;

import static org.assertj.core.api.Assertions.assertThat;

/**
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
Expand All @@ -26,6 +25,6 @@ public void testJsonOutput() throws IOException {

User expected = new User("_username", "test@example.com", "testUser", "hash");

assertEquals(user, expected);
assertThat(user).isEqualTo(expected);
}
}
Expand Up @@ -16,7 +16,6 @@
import org.zanata.rest.service.ETagUtils;

import static org.mockito.Mockito.when;
import static org.testng.Assert.*;

public class ProjectServiceTest {
private ProjectService service;
Expand Down
Expand Up @@ -6,9 +6,7 @@
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response;

import org.assertj.core.api.Assertions;
import org.assertj.core.util.Lists;
import org.hibernate.transform.ResultTransformer;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand All @@ -25,7 +23,6 @@
import org.zanata.model.HProjectIteration;
import org.zanata.rest.NoSuchEntityException;
import org.zanata.rest.ReadOnlyEntityException;
import org.zanata.rest.dto.Project;
import org.zanata.rest.dto.ProjectIteration;
import org.zanata.rest.dto.resource.ResourceMeta;
import org.zanata.rest.editor.dto.Locale;
Expand All @@ -45,7 +42,6 @@
import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.*;

public class ProjectVersionServiceTest {
private ProjectVersionService service;
Expand Down
Expand Up @@ -17,7 +17,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import static org.testng.Assert.*;

public class StatisticsServiceTest {
private StatisticsService service;
Expand Down
Expand Up @@ -2,8 +2,6 @@

import javax.ws.rs.core.Response;

import org.assertj.core.api.Assertions;
import org.assertj.core.util.Lists;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand All @@ -12,14 +10,12 @@
import org.zanata.common.LocaleId;
import org.zanata.dao.TextFlowDAO;
import org.zanata.model.HLocale;
import org.zanata.model.TestFixture;
import org.zanata.rest.editor.dto.TransUnits;
import org.zanata.rest.service.ResourceUtils;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.util.Lists.newArrayList;
import static org.mockito.Mockito.when;
import static org.testng.Assert.*;
import static org.zanata.model.TestFixture.makeHTextFlow;
import static org.zanata.model.TestFixture.makeTransUnit;

Expand Down
@@ -1,13 +1,13 @@
package org.zanata.rest.service;

import static org.testng.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Arrays;

import org.fedorahosted.openprops.Properties;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class PoUtilityTest {
String lineSep = System.getProperty("line.separator");

Expand Down

0 comments on commit 6dcb6a4

Please sign in to comment.