### Question:
SourceType { public static int getCategory(String source) { int type = 5; boolean flag = true; String[] temp = null; if (flag) { temp = stProps.getProperty("sina").split(","); for (int i = 0; i < temp.length; i++) { if (source.contains(temp[i])) { type = 0; flag = false; break; } } } if (flag) { temp = stProps.getProperty("pc").split(","); for (int i = 0; i < 3; i++) { if (source.contains(temp[i])) { type = 1; flag = false; break; } } } if (flag) { temp = stProps.getProperty("android").split(","); for (int i = 0; i < 3; i++) { if (source.contains(temp[i])) { type = 2; flag = false; break; } } } if (flag) { temp = stProps.getProperty("iphone").split(","); for (int i = 0; i < temp.length; i++) { if (source.contains(temp[i])) { type = 3; flag = false; break; } } } if (flag) { temp = stProps.getProperty("ipad").split(","); for (int i = 0; i < temp.length; i++) { if (source.contains(temp[i])) { type = 4; flag = false; break; } } } if (flag) { temp = stProps.getProperty("pc").split(","); for (int i = 3; i < temp.length; i++) { if (source.contains(temp[i])) { type = 1; flag = false; break; } } } if (flag) { temp = stProps.getProperty("android").split(","); for (int i = 3; i < temp.length; i++) { if (source.contains(temp[i])) { type = 2; flag = false; break; } } } return type; }  static int getCategory(String source);  }### Answer:
@Test public void testGetCategory() { assertEquals(0, SourceType.getCategory("新浪微博")); assertEquals(1, SourceType.getCategory("FaWave定时8")); assertEquals(2, SourceType.getCategory("智能手机三星")); assertEquals(3, SourceType.getCategory("iPhone红围脖")); assertEquals(4, SourceType.getCategory("平板OS")); }