Android Open Source - field-data-app Biological Sample Test






From Project

Back to project page field-data-app.

License

The source code is released under:

MIT License

If you think the Android project field-data-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package nz.cri.gns.springs.db;
//  w w  w .j ava2  s  .c  o m
import junit.framework.TestCase;
import nz.cri.gns.springs.db.BiologicalSample;

public class BiologicalSampleTest extends TestCase {

  public void testFormatSampleNumber() {
    assertEquals("P1.0001", BiologicalSample.formatSampleNumber(1));
    assertEquals("P1.12345", BiologicalSample.formatSampleNumber(12345));
    
  }
  
  public void testToTsvStringNullValue() {
    BiologicalSample sample = new BiologicalSample();
    sample.setId(1l);
    sample.setComments("This is a comment");
    sample.setConductivity(0.98);
    sample.setDnaVolume(2.123456);
    sample.setDo(3.14956);
    sample.setFerrousIronAbs(null);
    sample.setOrp(4.568);
    sample.setPh(6.5);
    sample.setSampleNumber(12);
    sample.setTemperature(556.36954);
    sample.setTurbidity(-56.3);
    
    String expected = "P1.0012\t556.3695\t6.5\t4.568\t0.98\t3.1496\t-56.3\t2.1235\t\tThis is a comment";
    String actual = sample.toTsvString();
    assertEquals(expected, actual);
  }
  
  public void testToTsvStringMultilineComment() {
    BiologicalSample sample = new BiologicalSample();
    sample.setId(1l);
    sample.setComments("This is a\nmultiline comment");
    sample.setConductivity(0.98);
    sample.setDnaVolume(2.123456);
    sample.setDo(3.14956);
    sample.setFerrousIronAbs(789.654123);
    sample.setOrp(4.568);
    sample.setPh(6.5);
    sample.setSampleNumber(12);
    sample.setTemperature(556.36954);
    sample.setTurbidity(-56.3);
    
    String expected = "P1.0012\t556.3695\t6.5\t4.568\t0.98\t3.1496\t-56.3\t2.1235\t789.6541\tThis is a multiline comment";
    String actual = sample.toTsvString();
    assertEquals(expected, actual);
  }  

}




Java Source Code List

nz.cri.gns.springs.GpsLocation.java
nz.cri.gns.springs.SpringsApplication.java
nz.cri.gns.springs.activity.BioSampleActivity.java
nz.cri.gns.springs.activity.EditBiologicalSamplesActivity.java
nz.cri.gns.springs.activity.MainMenuActivity.java
nz.cri.gns.springs.activity.ManageBioSamplesActivity.java
nz.cri.gns.springs.activity.SettingsActivity.java
nz.cri.gns.springs.db.BiologicalSampleTest.java
nz.cri.gns.springs.db.BiologicalSample.java
nz.cri.gns.springs.db.ChecklistItem.java
nz.cri.gns.springs.db.Configuration.java
nz.cri.gns.springs.db.FeatureTest.java
nz.cri.gns.springs.db.Feature.java
nz.cri.gns.springs.db.PersistentObject.java
nz.cri.gns.springs.db.SpringsDbHelper.java
nz.cri.gns.springs.db.SurveyImage.java
nz.cri.gns.springs.db.SurveyTest.java
nz.cri.gns.springs.db.Survey.java
nz.cri.gns.springs.fragments.AppearanceFragment.java
nz.cri.gns.springs.fragments.BioSampleActivityFragment.java
nz.cri.gns.springs.fragments.BioSampleFragment.java
nz.cri.gns.springs.fragments.ChooseImageFragment.java
nz.cri.gns.springs.fragments.ExportSamplesFragment.java
nz.cri.gns.springs.fragments.FeatureIdFragment.java
nz.cri.gns.springs.fragments.ImageColourPickerFragment.java
nz.cri.gns.springs.fragments.ImageFragment.java
nz.cri.gns.springs.fragments.SpringsDialogFragment.java
nz.cri.gns.springs.fragments.SpringsFragment.java
nz.cri.gns.springs.util.CustomExceptionHandler.java
nz.cri.gns.springs.util.DataStatistics.java
nz.cri.gns.springs.util.DateTimePickerDialog.java
nz.cri.gns.springs.util.UiUtil.java
nz.cri.gns.springs.util.Util.java