Permalink
Browse files

Add tests for com.freedomotic.nlp.Nlp

These tests were written by Diffblue Cover.
  • Loading branch information...
James-Adam authored and mcicolella committed Nov 22, 2018
1 parent 3b965d1 commit fb03d9b7cc879e07456046ebe885c2b0973d9766
Showing with 43 additions and 0 deletions.
  1. +43 −0 framework/freedomotic-core/src/test/java/com/freedomotic/nlp/NlpTest.java
@@ -0,0 +1,43 @@
package com.freedomotic.nlp;

import com.freedomotic.nlp.Nlp.DescendingRankComparator;
import com.freedomotic.nlp.Nlp.Rank;
import org.junit.rules.ExpectedException;
import org.junit.Rule;
import org.junit.Assert;
import org.junit.Test;

public class NlpTest {

@Rule public ExpectedException thrown = ExpectedException.none();

@Test
public void compareInputNotNullNotNullOutputZero() {

// Arrange
final DescendingRankComparator objectUnderTest = new DescendingRankComparator();
final Rank ob1 = new Rank(0, null);
final Rank ob2 = new Rank(0, null);

// Act
final int retval = objectUnderTest.compare(ob1, ob2);

// Assert result
Assert.assertEquals(0, retval);
}

@Test
public void compareInputNullNotNullOutputNullPointerException() {

// Arrange
final DescendingRankComparator objectUnderTest = new DescendingRankComparator();
final Rank ob1 = null;
final Rank ob2 = new Rank(0, null);

// Act
thrown.expect(NullPointerException.class);
objectUnderTest.compare(ob1, ob2);

// Method is not expected to return due to exception thrown
}
}

0 comments on commit fb03d9b

Please sign in to comment.