From 392ebf86d69b5f2eb17de376ad840da4c448b171 Mon Sep 17 00:00:00 2001 From: Edouard Tisserant Date: Mon, 7 Dec 2015 16:57:34 +0100 Subject: [PATCH] Enum Bug detected, and worked around. See code comment. --- .../app/src/main/java/com/pep/k9/MainActivity.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/androidTests/app/src/main/java/com/pep/k9/MainActivity.java b/androidTests/app/src/main/java/com/pep/k9/MainActivity.java index 0e7d775..a5b3fe7 100644 --- a/androidTests/app/src/main/java/com/pep/k9/MainActivity.java +++ b/androidTests/app/src/main/java/com/pep/k9/MainActivity.java @@ -95,7 +95,12 @@ public class MainActivity extends AppCompatActivity { // TEST : Call getter before call to getter - if(!(msg.getDir()==null)) throw new AssertionError(); + // BUG : if not already instantiated, enum cannot be mapped + // then getDir and getEncFormat return null. + Message.Direction _bug1 = Message.Direction.Incoming; + Message.EncFormat _bug2 = Message.EncFormat.None; + + if(!(msg.getDir() == Message.Direction.Incoming)) throw new AssertionError(); if(!(msg.getId()==null)) throw new AssertionError(); if(!(msg.getLongmsg()==null)) throw new AssertionError(); if(!(msg.getLongmsgFormatted()==null)) throw new AssertionError(); @@ -112,7 +117,7 @@ public class MainActivity extends AppCompatActivity { if(!(msg.getKeywords()==null)) throw new AssertionError(); if(!(msg.getComments()==null)) throw new AssertionError(); if(!(msg.getOptFields()==null)) throw new AssertionError(); - if(!(msg.getEncFormat()==null)) throw new AssertionError(); + if(!(msg.getEncFormat()==Message.EncFormat.None)) throw new AssertionError(); // TEST : Call setter with non-null // and check getter returns the same