@Test public void testSetLanguage() { dc = new DCLanguage(null); assertThat("testSetLanguage 0", dc.toString(), equalTo("")); dc = new DCLanguage(""); assertThat("testSetLanguage 1", dc.toString(), equalTo("")); dc = new DCLanguage("other"); assertThat("testSetLanguage 2", dc.toString(), equalTo("other")); dc = new DCLanguage("12"); assertThat("testSetLanguage 3", dc.toString(), equalTo("12")); dc = new DCLanguage("12345"); assertThat("testSetLanguage 4", dc.toString(), equalTo("45_12")); dc = new DCLanguage("123456"); assertThat("testSetLanguage 5", dc.toString(), equalTo("")); dc = new DCLanguage("1234567890"); assertThat("testSetLanguage 6", dc.toString(), equalTo("")); }
public final void setLanguage(String l) { if(l == null) { language = ""; country = ""; } else if("other".equals(l)) { language = "other"; country = ""; } else if (l.length() == 2) { language = l; country = ""; } else if (l.length() == 5) { language = l.substring(0, 2); country = l.substring(3); } else { language = ""; country = ""; } }
DCLanguage { public final void setLanguage(String l) { if(l == null) { language = ""; country = ""; } else if("other".equals(l)) { language = "other"; country = ""; } else if (l.length() == 2) { language = l; country = ""; } else if (l.length() == 5) { language = l.substring(0, 2); country = l.substring(3); } else { language = ""; country = ""; } } }
DCLanguage { public final void setLanguage(String l) { if(l == null) { language = ""; country = ""; } else if("other".equals(l)) { language = "other"; country = ""; } else if (l.length() == 2) { language = l; country = ""; } else if (l.length() == 5) { language = l.substring(0, 2); country = l.substring(3); } else { language = ""; country = ""; } } DCLanguage(String l); }
DCLanguage { public final void setLanguage(String l) { if(l == null) { language = ""; country = ""; } else if("other".equals(l)) { language = "other"; country = ""; } else if (l.length() == 2) { language = l; country = ""; } else if (l.length() == 5) { language = l.substring(0, 2); country = l.substring(3); } else { language = ""; country = ""; } } DCLanguage(String l); String toString(); final void setLanguage(String l); String getDisplayName(); }
DCLanguage { public final void setLanguage(String l) { if(l == null) { language = ""; country = ""; } else if("other".equals(l)) { language = "other"; country = ""; } else if (l.length() == 2) { language = l; country = ""; } else if (l.length() == 5) { language = l.substring(0, 2); country = l.substring(3); } else { language = ""; country = ""; } } DCLanguage(String l); String toString(); final void setLanguage(String l); String getDisplayName();  }